CloudFormation: Create resources if they do not exist, but do not delete them

北城余情 提交于 2019-11-30 21:21:34

When you are updating your existing stack, do not change the parameters. So even when you are updating your stack, set ShouldCreateTable to true.

Yes, it seems counter-intuitive when updating your stack to say "Create a table", when a table already exists, but you need to do that.

The reason is this:

  1. When the stack is created, you set ShouldCreateTable to true, and the template applies it's conditional logic and creates the table as it's own managed resource.
  2. When the stack is updated, you set ShouldCreateTable to false, and the template applies it's conditional logic and determines you no longer need the managed table because you're providing your own now. The resource should be deleted. It does not recognize that the table is the same.

When using your template, only say ShouldCreateTable == false if you are providing your own table that you created.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!