Setting up the basics for using cdk
I could keep this part very short by saying follow the steps listed in the aws documentation for installing and using cdk
I'll help you out with a few more links to the prerequisites:
- download and install node. You need this to be able to build you cdk application. also comes with a lot of handy tools.
- download an install aws cli. It will be used to configure your aws credentials and to be able to deploy your application.
you can either install cdk globally with npm install -g aws-cdk
or you can use npx to run it once.
run the following to create the infrastructure app.
mkdir infra
cd infra
npx cdk init app --language typescript
After running this command you will have a folder with all the tings to get started. The folder structure should resemble this.
├── README.md
├── bin
│ └── infra.ts
├── cdk.json
├── jest.config.js
├── lib
│ └── infra-stack.ts
├── package-lock.json
├── package.json
├── test
│ └── infra.test.ts
└── tsconfig.json
What goes where
In the bin/infra.ts you have the entrypoint of the program. this is defined in the cdk.json file.
In the lib you gather your own files or add your own constructs and stacks. For now there's one file infra-stack.ts. It contains your first stack. This is where you define the infrastructure in.
Thanks for reading
I enjoyed trying to make everything and I hope you'll enjoy reading it. If you are excited to have a chat or think I could improve feel free to write me on LinkedIn. I also have portfolio website where I put most of what I make and host trial projects portfolio.rohanengosia.com.