Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Amplify: How to recreate manually deleted CloudFormation stacks

I built an Amplify sample application following this workshop. Afterwards, I manually deleted CloudFormation stacks (from the AWS console - selected root stack and executed delete stack action) hoping that I can rebuild them using amplify push. Unfortunately, amplify reports no changes and do not rebuild stacks. Is there a way to force amplify to provision the resources?

like image 517
Tommy Avatar asked Mar 15 '19 11:03

Tommy


2 Answers

amplify cli checks diff between amplify/#current-cloud-backend and amplify/backend folder inside your project. It doesn't check what is currently deployed in the cloud.

Since you have deleted the root stack, even if there were any changes to push, it would fail as the stack is missing. To recover from this error you can run amplify init and and when asked Do you want to use an existing environment? select No. This will recreate the root stack and will allow you to push your changes.

PS: Multi environment support is available in amplify cli version 1 and above. If its pre v1 init command won't work

like image 125
Yathi Avatar answered Oct 07 '22 00:10

Yathi


If you delete a function or an API which other resources depend on, this could lead to the push to fail. So what I usually do, is to recreate the same function or API and push it again. It's a provisional hack I use, but I think there could be a better one.

like image 41
gildniy Avatar answered Oct 06 '22 23:10

gildniy