Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually rollback CloudFormation deployment of Lambda functions?

In my CodePipeline, I am creating a CloudFormation ChangeSet and then executing it to deploy Lambda functions. It doesn't seem like CloudFormation saves the old ChangeSets so that I can revert to an old version. Am I wrong?

CloudFormation does automatically rollback when it fails to create/execute the ChangeSet due to IAM permission issues and such but I want the ability to manually rollback in case I deploy a buggy function.

like image 441
nuclear Avatar asked Oct 19 '25 11:10

nuclear


1 Answers

You could use rollback triggers in AWS CloudFormation to detect failed tests in your code, via Amazon CloudWatch metrics and alarms, and perform an automated rollback.

Your application code would need to be modified to perform the tests upon deployment, and then write the metric values into Amazon CloudWatch.

There are a couple limits you'll want to be aware of:

  • Maximum of five (5) rollback configurations per CloudFormation stack
  • Monitoring time: 0 - 180 minutes (3 hours)