This is an example of containerized AWS CDK which you may use in any of your projects.
3 Musketeers for an epic Developer Experience
The contents of the infrastructure
directory is the output of running cdk init sample-app --language typescript
To use this repo either start from there or replace the infrastructure
directory with your existing typescript cdk project
- Simply run
make
, this will do all the setup and runcdk synth
$ make
- If you have never used aws CDK in your configured AWS account before then you must use the cdk bootstraper
$ make bootstrap
- You are now free to run any other commands available such as
cdk diff
,cdk deploy
, andcdk destroy
If you have an existing project and would like to use this 3 musketeers setup follow these steps
- Copy the
Makefile
,Dockerfile
, anddocker-compose.yaml
files into the root of your project - Update the
CDK_PATH
variable inthree_musketeers.env
andMakefile
- run
make
to do initial setup and output cdk synth to verify everything is configured right
Run the needed setup steps to allow working with CDK
$ make pre-reqs
Spits out some useful troubleshooting info: see containerInfo.sh
$ make container-info
Deletes contents of cdk.out and node_modules
$ make clear-cache
Simply run npm install
from inside of the container
$ make npm-install
Builds the container image
$ make container-build
This resolves Error: EACCES: permission denied, open 'cdk.out/tree.json', must be run before any cdk commands are run
$ make_prep-cache
The following commands directly correspond to CDK CLI commands, it is an action item to implement all CDK commands
$ make bootstrap
See the CloudFromation output
$ make synth
Output the difference between what is currently deployed to AWS and what is written in your CDK stack/s
$ make diff
$ make deploy
$ make destroy
Enter into the container terminal to issue commands directly
$ make cli
Error: EACCES: permission denied, open 'cdk.out/tree.json'
This error is caused by permissions on the cdk.out directory. Ensure your user owns this, not root. To resolve run make pre-reqs
- Handle a new project init
- Find a way not to have to use force on destroy and deploy