Create CloudFomation stack only after the creation of another CloudFormation stack

0

I've created two CloudFormation templates.

The first one will create a DynamoDB table.

The second one will operate on the DynamoDB table created.

The resources need to be on separate stacks because the second stack can be deleted and recreated multiple times.

As you can see, I need the first stack to be created first and, only after that, create the second one.

But, from my node aplication, I have no idea how can I do that. If I just send the requests to CloudFormation, they will be created in an arbitrary order.

How can I solve this problem?

2 Answers
1

As per the other answer, nested stacks are a good way of doing this.

But you can monitor stack events with EventBridge and SNS. So you can create the first stack and have it send a message on completion which you could use as a trigger for the second stack. Export the name of the DynamoDB table from the first stack to consume it in the second.

profile pictureAWS
EXPERT
answered 2 months ago
profile pictureAWS
EXPERT
iBehr
reviewed 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions