ThatChrisGuy
ThatChrisGuy

Reputation: 609

How to make sure a resource is the last to be created from a CloudFormation template?

I want to use a custom resource to perform "post-deployment"-like modifications upon deploying a template.

Since it is a big template and I want to be able to create most of the resources in parallel, I would like to avoid adding DependsOn everywhere.

Is there a way to make sure that the last thing the deployment does is call the function of that lambda-backed custom resource?

Upvotes: 1

Views: 559

Answers (1)

SHASHIDHAR V
SHASHIDHAR V

Reputation: 54

The solution can be adding all the resources in nested template and keep custom resource in parent CFT which can be called after nested stack is created successfully. So, your parent CFT which contain 2 resources,

  1. AWS::Cloudformation::Stack
  2. Cloudformation custom resource

In this case just one DependsOn is needed not multiple.

I hope you find this approach interesting.

Upvotes: 1

Related Questions