Custom Resource with CloudFormation


Use Case

If you include execution of a Lambda in your CloudFormation template and you update your Lambda Code, CloudFormation will not execute your Custom Resource again unless it detects that the template or parameters have been changed. Here are two Workarounds to invoke Custom Resources after CFN Update.

Workaround 1: Include a Parameter

A very easy way to execute the Custom Resource every time when your Lambda changed is to add a parameter to your Custom Resource (eg. a timestamp, which will always be different) - if this parameter changes, the custom resources will automatically be executed again.

    Type: String
    Default: 201906010800
    Type: 'Custom::ExecuteLambda'
      ServiceToken: !GetAtt
        - Lambda
        - Arn
      Timestamp: !Ref LambdaExecutionTimestamp

Workaround 2: Use SNS to invoke the Custom Ressource

Use an SNS trigger to invoke your Custom Resource, when your Cloudformation Stack is updated.

Use SNS to invoke the Custom Ressource

Addtional Information: Handling AWS Cloudformation Events


Share your ACM Private CA cross-account

How to automate AWS RAM to share your ACM Private CA cross-account


Sep 3rd 2020


David Krohn

App Mesh and ECS with shared Meshes

Step by Step Tutorial on how to use App Mesh on ECS with cross account ressource sharing (shared meshes)


Jul 25th 2020


Yassine Berrada Touati

Terraform CI/CD Best Practices

Running Terraform in Automation


May 15th 2020


Mohammed Yahya