Source: towardsaws.com

Deploy bootstrapped EC2 with CDK

Category: Software, encryption

In this guide I use CDK with typescript to deploy an EC2 instance that is ready to go with an application, domain joining as well as custom configuration.

I have done this in the past using Cloudformation, but it took me a long time before I bothered to investigate how to do this using CDK.

In this example we are creating a standalone volume for the D drive that is encrypted with kms that exists in a centralized account.

I discovered in this case however that cfn-signal.exe was never sent back to the stack because my configuration of the instance has a reboot in it and the way UserData works is that it’s not persistent, meaning that it runs only the first time the instance is started.

When you see the success signal in this file you will see it as an event in the Cloudformation stack in the AWS console.

Related Articles