- Newest
- Most votes
- Most comments
There is no CDK API to do this directly. However, you can use one of the following approaches to implement it by yourself.
A Lambda-backed custom CDK resource in your CDK stack
Implement a custom resource using this example as a reference. In the Lambda function, you can modify the underlying EC2 instance by using the AWS SDK. The EC2 instance running a Cloud9 environment has a tag aws:cloud9:environment
with the value of the environment ID, so you can use this tag to obtain the EC2 instance ID. Using the Lambda function and the AWS SDK, you can modify the underlying EC2 instance in the way you want.
Systems Manager Document
You can leverage AWS Systems Manager and its Documents for setting up the instance. Take a look on this CDK construct on ConstructHub. This construct provides a method resizeEBSTo
for configuring the instance's EBS volume. You can add another Document steps using the addDocumentSteps
method for any other required changes.
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 3 years ago
I also hope to have a tutorial about how to reduce the size of root EBS for windows instances also.