amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

How to add existing amplify back end to the amplify front end?

Open yvescoinpass opened this issue 6 years ago • 10 comments

** Which Category is your question related to? ** Auth, Storage, API

** What AWS Services are you utilizing? ** Cognito, AWS AppSync,

** Provide additional details e.g. code snippets ** I accidentally deleted my amplify frontend and I created a new one. How do I add again the existing amplify back end to the newly created amplify app?

I followed the steps on the backend tab

  1. amplify init --appId ("ID OF YOUR NEW AMPLIFY APP").

  2. Instead of amplify add CATEGORY HERE. I use amplify update CATEGORY HERE

Then amplify push

But when I check the amplify app on the AWS console there still no backend integrated to it.

Am I doing correct?

aws-amplify": "^2.1.0 @aws-amplify/[email protected]

yvescoinpass avatar Feb 23 '20 17:02 yvescoinpass

@yvescoinpass which version of the CLI are you using?

nikhname avatar Feb 26 '20 01:02 nikhname

Hello @nikhname, thanks for taking the time responding to my question. I am using @aws-amplify/[email protected]

yvescoinpass avatar Feb 26 '20 06:02 yvescoinpass

Try to follow these steps to first recover, and then add a new backend Env if you want to.

  1. amplify pull --appId <your-project-appId> --envName <your-existing-backend-env>
  2. amplify init and select the existing backend env if prompted

Now your amplify folder structure is fully setup, they you can add new backend env by

amplify env add

UnleashedMind avatar Mar 02 '20 21:03 UnleashedMind

Hello @UnleashedMind. I got an error while trying to input the name of the env

Cannot find backend environment master in Amplify Console app

I am really sure that the name of the env was master. I think the env was deleted too when I accedentally deleted the amplify app?

yvescoinpass avatar Mar 03 '20 06:03 yvescoinpass

I think the issue was I deleted my the whole amplify project on AWS Console but I still have the existing amplify code base on my github repo.

So what I did was

  1. Created a new amplify project on aws console.
  2. Connect the existing repository on github
  3. On my local machine I git pull the repo.
  4. amplify init --appId ("THE RECENTLY CREATED APP ID HERE").
  5. Then. I use amplify update CATEGORY HERE
  6. Then amplify push

That's it then the back-end is working again but it is not just showing on Aws Amplify Console Backend Environments tab

yvescoinpass avatar Mar 03 '20 07:03 yvescoinpass

Same here, when adding an extra environment (add env) it shows up in the backend tab of the console, but the already existing environments are not showing. Using @aws-amplify/[email protected]

FemkeBuijs avatar Mar 05 '20 16:03 FemkeBuijs

Recovering the deleted Amplify Console project is not in the Amplify CLI's normal workflow. But there's the following hack that triggers the CLI post push check that you can try:

  1. On your local amplify project, run amplify env checkout <the-missing-endName-on-Console>
  2. open the amplify-meta.json files in both the backend and #current-cloud-backend folder, make sure the providers.awscloudformation does not contain the field `AmplifyAppId", remove it if it's there.
  3. open the team-provider-info.json file, make sure the \<the-missing-endName-on-Console\>.awscloudformation does not contain the field `AmplifyAppId", remove it if it's there.
  4. make a tiny dummy change in the backend, such as adding a space in in the template file of amplify/backend/storage
  5. run amplify push

UnleashedMind avatar Mar 11 '20 21:03 UnleashedMind

Works like a charm @UnleashedMind, thanks!! I tried changing the AmplifyAppId to the correct one, but removing it made it change by itself. Awesome.

FemkeBuijs avatar Mar 16 '20 09:03 FemkeBuijs

its incredible have so many problems deploying a aws amplify app, and manage more than one env accross different aws accounts...

miguel258 avatar May 12 '20 03:05 miguel258

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 26 '21 08:05 github-actions[bot]