Aws-cdk: Allow an app alias to be set in cdk.json

Created on 17 Oct 2019  路  4Comments  路  Source: aws/aws-cdk


I did try and search for open issues on this. My apologies if one already exists.
I would like the cdk.json file to allow for multiple app entries. Currently it defaults to only "app" in cdk.json and if I want to override that, I need to remember a long string:
cdk --app "npx ts-node bin/hello-cdk.ts" ls. I propose that a custom alias can be set in the cdk.json file.

Use Case


This would allow me to separate and process my stacks using a memorable alias vs the whole command.

Proposed Solution


I propose that an app alias can also be specified in cdk.json. As an example:

{
  "app": "npx ts-node bin/cdk.ts",
  "helloWorld": "npx ts-node bin/hello-cdk.ts"
}

which would allow me to call
cdk --app helloWorld ls.

Other

  • [x] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

This is a :rocket: Feature Request

efformedium feature-request managemendevenv p2 packagtools

Most helpful comment

I like this idea!

All 4 comments

I like this idea!

Can I ask what the different apps do, and why you don't want to combine them into a single app?

@rix0rrr - We have our core application CDK file, and then we have CDK files that are related to the application, but not directly. As an example, app.ts is for the application's infracture and then users.ts for our internal users and their respective permissions for console/API access. If we have a change in our staff, I update users.ts and deploy that stack change specifically.

As to why I don't combine them, they're logically separate in my mind so it makes sense to me for the files/entrypoint to be different vs having one large cdk.ts.

I hope that helps clarify my thought processes. Let me know if you have additional questions. Thanks!

I have another use case for a feature like that:

For rolling out a static (SPA) website, we need to create resources in two regions (ACM certs / Lambda@Edge in us-east-1 for CloudFront and everything else like S3, etc. in our region). Because CDK (and CloudFormation) can't pass references across stacks, which are across different regions, I would split these resources into two different apps and handle passing the references somehow else.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kawamoto picture kawamoto  路  3Comments

artyom-melnikov picture artyom-melnikov  路  3Comments

v-do picture v-do  路  3Comments

pepastach picture pepastach  路  3Comments

abelmokadem picture abelmokadem  路  3Comments