Automating with AWS CDK
AWS CDK is a multi-language SDK that lets you write code to define AWS infrastructure (https://github.com/aws/aws-cdk). Using the CDK CLI, you can then provision this infrastructure, using CloudFormation under the hood.
Installing the CDK
The CDK is natively implemented with Node.js, so please make sure that the npm
tool is installed on your machine (https://www.npmjs.com/get-npm).
Installing the CDK is then as simple as this:
$ npm i -g aws-cdk $ cdk --version 1.114.0 (build 7e41b6b)
Let's create a CDK application and deploy an endpoint.
Creating a CDK application
We'll deploy the same model that we deployed with CloudFormation. I'll use Python, and you could also use JavaScript, TypeScript, Java, and .NET. API documentation is available at https://docs.aws.amazon.com/cdk/api/latest/python/:
- First, we create a Python application named
endpoint
:$ mkdir cdk $ cd cdk $ cdk init --language python --app endpoint
...