1

I accidently deployed my amplify app to the wrong region and account, but I've put a lot of work into the API. How do I change the profile and redeploy everything without having to completely rebuild the API?

I've deleted the app from the management console in the wrong region/account, and that just seems to make the amplify cli short circuit. It can't run amplify init successfully because it looks for an application key online apparently, that is missing (the deployed app is blown away).

Any help here would be nice. Quite frustrating.

Jamie Marshall
  • 1,885
  • 3
  • 27
  • 50

1 Answers1

1

Here are the steps on how to change the profile and redeploy your Amplify app without having to completely rebuild the API:

  1. Delete the app from the AWS Management Console in the wrong region/account.
  2. Open the amplify/.config/local-aws-info.json file in a text editor. (this will be hidden most likely in your IDE)
  3. Find the profileName property and change the value to the name of the AWS profile that you want to use.
  4. Save the file and close it.
  5. Run the amplify push command

This will redeploy your app to the new region/account using the new AWS profile.

Here are some additional details about each step:

  1. When you delete the app from the AWS Management Console, it will also delete all of the resources that were created for the app. This includes the API, database, and any other resources that were created.
  2. The amplify/.config/local-aws-info.json file contains the configuration information for your Amplify app. This includes the region/account that the app is deployed to, the AWS profile that is used to access the app, and other settings.
  3. The profileName property specifies the name of the AWS profile that is used to access the app. You can create new AWS profiles in the AWS Management Console.
  4. The amplify push command will deploy your app to the region/account that is specified in the amplify/.config/local-aws-info.json file. It will also use the AWS profile that is specified in the profileName property.

Code example of the file:

{
  "versionOne": {
    "configLevel": "project",
    "useProfile": true,
    "profileName": "profileName"
  },
  "preDeployment": {
    "configLevel": "project",
    "useProfile": true,
    "profileName": "profileName"
  }
}
Luke
  • 761
  • 1
  • 18