In this chapter we create the first CDK GO app. We use CDK V2 from the start.
Node.JS has to be installed.
NPX takes care of dealing with CDK and calling a version
npm install -g npx
See aws-cdk tags for the latest version.
Assume its version v2.0.0-rc.24
On linux/mac you can create an alias to npx and the right CDK version. Version pinning, that is the process of using a fixed version of the CDK is vital when using the CDK.
alias cdk='npx cdk@v2.0.0-rc.24'
Test CDK version with:
cdk --version
If you do not get the current version, try the alternate approach “install CDK globally”:
npx cdk@v2.0.0-rc.24 --version
npm ERR! cb.apply is not a function
...
npm i cdk@v2.0.0-rc.24 -g
unalias cdk
Test CDK version with:
cdk --version
After the preparation we can continue to the creation of an GO CDK APP in the next chapter.
If you use CDK for the very first time or if the bootstrap version changes, you have to bootstrap your AWS account:
cdk bootstrap
CDK tries to determine account and region automatically. If that’s work, fie you are done.
Otherwise continue:
aws sts get-caller-identity
Note the *“Account”: “555548271754”,
Choose your aws region, here eu-central-1.
cdk bootstrap aws://555548271754/eu-central-1
Bootstrap creates an S3 bucket for deployment and some roles. You can inspect the CDKToolkit CloudFormation stack for details.