question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please 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:open
  • Created 4 years ago
  • Reactions:180
  • Comments:35 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
eladbcommented, Jun 30, 2019

I am wondering if custom resources would be sufficient for these use cases…

12reactions
bgdnlpcommented, Jul 1, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found