nuclear
nuclear

Reputation: 365

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.

Upvotes: 2

Views: 5289

Answers (1)

user189198
user189198

Reputation:

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)

Upvotes: 2

Related Questions