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.

spec: cdk package

See original GitHub issue

Following up on this comment, this issue is an initial spec for a new CLI command called (for now) cdk package.

Similarly to the cloudformation package and sam package commands, the new cdk package STACK will:

  1. Build local assets (docker images, zip directories) defined in a cloud assembly,
  2. Upload them to S3/ECR and
  3. Upload the CloudFormation template for that stack to S3, with the asset CloudFormation parameters default values set to point to the publish locations.
  4. It will then return an S3 URL (presigned?) that is a self-contained template that can be deployed to the environment with no additional information required. Another interesting benefit of the self-contained template is that it represents a “point in time”, which can be easily rolled back if needed.

Currently this process is performed by cdk deploy. Decoupling package from deploy is required in order to mitigate risks related to running docker build in an environment that has administrative privileges, and also to allow using of native cloudformation APIs for deployments, instead of requiring to run a container with cdk deploy. This addresses users’s concern around costs and constraints the administrative IAM role in remote accounts to the cloudformation service principal).

Similar to the approach we took with cdk synth (which produces a cloud assembly as an output), cdk deploy will automatically invoke cdk package but it will also be possible to invoke them independently (similar to cdk synth). We can decide that if --app points to an s3:// url, cdk deploy will treat it as a ready-to-deploy template.

The eventual flow will be:

[cdk synth] => cdk.out(cloud-assembly) => [cdk package] => s3://template-url => [cdk deploy] => stack

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
eladbcommented, Aug 7, 2019

@jewelsjacobs since we are trying to be agnostic to programming languages/framework/build tools, our approach is that if you want something to be available during synthesis it needs to be there before you run cdk synth.

So in the case of building websites, your approach is what we expect people to do: run some pre-synth commands that will produce the website (either in .zip format or just a “dist” directory) and then during synth, reference this artifact and let the CDK do it’s work to package it and deploy it.

Does that make sense?

1reaction
jcommented, Aug 6, 2019

I was just about to create an issue asking how to do a sam package equivalent.

Currently in CI, we do a sam package and push the CF packaged template to S3 and use that template to deploy/promote stages to various AWS accounts.

Also, currently with sam we have to build ourselves because their build system is kinda broken for advanced node.js apps (typescript, etc). So if CDK can support any type of build system, having it build would be cool, otherwise, we still want to be able to build deployables ourselves.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started with the AWS CDK - AWS Documentation
The main CDK package is called aws-cdk-lib , and it contains the majority of the AWS Construct Library. It also contains base classes...
Read more >
@aws-cdk/cfnspec - npm
The CloudFormation resource specification used by @aws-cdk packages. Latest version: 1.182.0, last published: 6 days ago.
Read more >
cdk-alps-spec-rest-api - PyPI
The CDK Alps Spec Rest Api construct generates an AWS API Gateway out of an ALPS API yaml file such src/todo-alps.yaml. ALPS API...
Read more >
@stackspot/cdk-component-openapi-typescript - Socket
A CDK construct for Typescript that can be used to create the AWS ... a API Gateway to Lambda integration based on an...
Read more >
Which way is better to put buildspec.yml, in CDK or root ...
Which way is better to add buildspec.yml, in CDK package or source code package? Pass. It depends on the use case and developer...
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