CDK CLI Triggers
See original GitHub issuePlease take a look at #71 and let us know if this will address your use case.
A post-deploy hook would be handy - sometimes its useful to have something that runs after a successful cdk deploy
. Otherwise, CDK will force end users have CDK run in wrapper scripts
What would also be handy is if during this postDeploy()
functionality, if cloudFormation resources were no longer tokens, but were fully fleshed out and available
Something like the following would be convenient -
import cdk = require('@aws-cdk/cdk');
function runAfterCompletion(NameOfResource: string){
notifyMyTeam(`mySuperCoolStack has deployed ${NameOfResource}`);
}
const app = new cdk.App();
const myAsg = new mySuperCoolAsgStack(app, "VPC", {props: "props"});
app.run()
app.postDeploy(runAfterCompletion, myAsg.GetAsg.autoScalingGroupName);
Issue Analytics
- State:
- Created 4 years ago
- Reactions:180
- Comments:35 (4 by maintainers)
Top Results From Across the Web
AWS CDK Toolkit (cdk command) - AWS Documentation
The AWS CDK Toolkit, the CLI command cdk , is the primary tool for interacting with your AWS CDK app. It executes your...
Read more >cdk-triggers - npm
Execute AWS Lambda handlers during deployments of AWS CDK stacks. Latest version: 0.1.35, last published: 10 months ago.
Read more >How to Trigger an AWS Lambda from S3
In this post we are going to use the AWS CDK to build an AWS Lambda Function that triggers from AWS S3 Put...
Read more >Trigger Lambda On S3 Events Using CDK - In Plain English
A trigger is a Lambda resource or a resource in another service that you configure to invoke your function in response to lifecycle...
Read more >AWS Event-driven Serverless Patterns via the AWS CDK
Next, update lib/how-to-trigger-lambda-from-sqs-stack.ts with the following CDK code. Finally, deploy your stack using the CDK CLI ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am wondering if custom resources would be sufficient for these use cases…
Custom resources can’t replace hooks completely. Leaving aside the ease of use, the main difference is where the code is executed.
Simple example. Use the CDK as part of CD/CI pipeline that runs on a Jenkins server. The CDK deals with EC2, so the Jenkins role only has access to EC2. With a hook, that’s enough. With a custom resource, Jenkins now needs access to set up and run arbitrary Lambda functions, along with the roles attached to those functions.
Another example, a simple notification before and after deploy. To Slack, email, whatever. With a hook it’s just a local script. Custom resources need more setup.
Many use cases can be worked around with custom resources. But it’s clumsy and it complicates things considerably. Especially in bigger organisations, where access has to be vetted by a different team.