Aws cdk installation - SoftupTechnologies/infrastructure-components GitHub Wiki

To install aws cdk globally run:

npm install -g aws-cdk

To deploy the resources in aws the configured IAM user should have permissions in the specific resources, or be an admin that has access in all the resources. Ideally the user set up to use aws cdk should have limited permissions only on the resources that are needed.

This boilerplate is developed using Typescript so the setup will be using the Typescript language.

Create a directory:

mkdir my-cdk-app

cd my-cdk-app

And run:

cdk init app --language typescript

The cdk cli will generate the environment we need to develop the components. If you have a specific profile name in your aws configuration, rather than the default one, you must set the AWS_PROFILE variable before executing aws cdk commands.

export AWS_PROFILE=[PROFILE NAME]

To create the toolkit that will manage the resources in cloudformation run:

cdk bootstrap

This creates a toolkit which cdk uses to make stack diffs and other duties.

Other commands:

yarn watch to always transpile the TS to JS and check for errors.

cdk diff to see the changes in resources before deploying the stack.

cdk deploy deploys the stack to cloudformation (Will ask for confirmation).

cdk deploy --require-approval never to skip the confirmation.

cdk destroy to delete the created cloudformation stack (Will ask for confirmation).

cdk destroy --force to skip the confirmation.