How to add existing amplify back end to the amplify front end?
** 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
-
amplify init --appId ("ID OF YOUR NEW AMPLIFY APP"). -
Instead of
amplify add CATEGORY HERE. I useamplify 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 which version of the CLI are you using?
Hello @nikhname, thanks for taking the time responding to my question. I am using @aws-amplify/[email protected]
Try to follow these steps to first recover, and then add a new backend Env if you want to.
amplify pull --appId <your-project-appId> --envName <your-existing-backend-env>amplify initand 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
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?
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
- Created a new amplify project on aws console.
- Connect the existing repository on github
- On my local machine I
git pullthe repo. amplify init --appId ("THE RECENTLY CREATED APP ID HERE").- Then. I use
amplify update CATEGORY HERE - 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
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]
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:
- On your local amplify project, run
amplify env checkout <the-missing-endName-on-Console> - open the
amplify-meta.jsonfiles in both thebackendand#current-cloud-backendfolder, make sure theproviders.awscloudformationdoes not contain the field `AmplifyAppId", remove it if it's there. - open the
team-provider-info.jsonfile, make sure the\<the-missing-endName-on-Console\>.awscloudformationdoes not contain the field `AmplifyAppId", remove it if it's there. - make a tiny dummy change in the backend, such as adding a space in in the template file of
amplify/backend/storage - run
amplify push
Works like a charm @UnleashedMind, thanks!! I tried changing the AmplifyAppId to the correct one, but removing it made it change by itself. Awesome.
its incredible have so many problems deploying a aws amplify app, and manage more than one env accross different aws accounts...
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.