...

/

Rollbacks and User Data Practical

Rollbacks and User Data Practical

Build on your understanding of cfn scripts and learn about CloudFormation rollbacks in this practical.

Rollbacks

When a CloudFormation stack fails, it enters a rollback state by default. This means all changes made by the failed stack revert. All resources are deleted if the failed stack is being created (run for the first time). For example, let’s take a CloudFormation stack that creates an EC2 instance and an RDS database. If the stack created an EC2 instance and then failed while creating an RDS database, the rollback operation will delete the EC2 instance and any other RDS resources created in the stack.

If the stack fails during an update, a rollback will delete or revert all changes made during the update and roll back to the previous working state. For example, let’s take a stack that has created a t2.micro EC2 instance and update its stack to change EC2 to t2.small and add a security group. If the ...