The CDK despite being fairly new has a lot of benefits in that you can use the same tools, processes and editors you would use for typical language development. I primarily work with CDK in
typescript and wanted to share a bit about what I use.
For a long time I was a big vim fan, I still use it frequently but my go to editor is now Visual Studio Code. There are a few reasons for doing this.
- Cross-OS ease of development - With my current position I use a Windows laptop for development of Python CDK but am able to use WSL for a Linux type environment locally. This integrates well with Code and I can directly open into WSL using the
code .terminal command.
- Intellisense - Code completion with Intellisense for both Python and Typescript works very well with the CDK and helps me avoid checking documentation in my browser frequently.
- Community - Both at my job and in the wider development community there are many Code users and the AWS Toolkit plugin for it even has some built in CDK functionality with the CDK Explorer
- AWS Toolkit
- Remote Containers
- Git Lens (I primarily use this for displaying git info inline and use the CLI for all other git interactions)
When you first initialize a project with the
cdk cli tool it sets up dependency handling for you using either
pip for Python or
npm for Typescript. This is useful for installing the various CDK libraries needed, including any custom ones.
npm works well enough I don’t foresee migrating to another solution. However, for
pip I am considering using more robust solution.
Pip, while working, has issues where adding and managing the
requirements.txt file is a pain. I’ve used pipenv in the past but that does not support multiple Python versions and the owner has made it clear it probably won’t be. Another popular option which is now supported by the CDK in the aws-lambda-python construct is poetry.
poetry a bit and have enjoyed it. It has a very similar syntax compared with
npm and works well. Going forward this will be my preferred solution.
I’ve used a number of CI/CD tools for CDK deployments and by far the easiest so far has been GitHub Actions. Specifically with the AWS CDK GitHub Actions action, that supports both Typescript and Python it works great out of the box. This blog is even deployed using this strategy.
Others I have used are CDK Pipelines which work well once setup and the self-mutating pipeline is cool but requires a lot of CDK and Codepipeline knowledge that is a pain. Bamboo is another tool I have used but I don’t recommend it. There is a lot of initial setup, the Docker handling of it is poor, and it is expensive, especially for personal projects.