With CDK, can it be triggered through a lambda to deploy the stack

Viewed 1559

CDK is good to building the AWS application stack. As far as I know, we can write CDK code and then use cdk deploy to deploy the application stack we created.

But is that possible to programmatically trigger the CDK code? For example, I wrap CDK code into lambda, and trigger it on demand (will pass in some parameters so that the application we create can be customized), and when lambda finishes, we have the application stack created.

1 Answers

That's possible - but messy.

In that case your Lambda Function just needs to have permissions to talk to CloudFormation and to create all the resources it might need.

Then you get into the mess of triggering the CDK via Code.

There are a couple of people that have tried this, maybe this helps with your research:

Depending on your use case it might be worth considering doing this via CodePipeline or have users provision infrastructure via Service Catalogue.

Related