This example project contains the AWS CDK Python code for provisioning an Imagizer Cluster on AWS.
Note: AWS CDK supports multiple languages. This project uses Python 3.
Begin by installing the required dependencies. This project requires Python3, NodeJS, NPM, and the AWS CLI. The AWS CLI must be configured with sufficient permissions to create AWS resources.
Run the following to compile and install the project.
# Install the AWS CDK
npm install --ignore-scripts
# Create a python virtual environment
python3 -m venv venv
# Install the Python dependencies
venv/bin/pip3 install -r requirements.txt
# Install the CDK Cli
npm install aws-cdk
# Active the Python environment
source venv/bin/activate
- Modify the imagizer_aws/variables.py file making note to add the Imagizer AMI ID.
- Modify the imagizer_aws/imagizer-config.json to your needs while leaving the cluster configuration untouched to allow for Imagizer Clustering.
Review the documentation from AWS
npx cdk ls
list all stacks in the appnpx cdk synth
emits the synthesized CloudFormation templatenpx cdk deploy
deploy this stack to your default AWS account/regionnpx cdk diff
compare deployed stack with current statenpx cdk docs
open CDK documentation
Deploying will create a change set and apply any changes to the already provisioned AWS resources.
npx cdk deploy "*"
All stacks are located in the imagizer_aws/stacks folder.
imagizer_aws/stacks/base_stack.py
The Base stack includes the basic components for a regional base, such as a VPC, Subnets, DNS records, SSL certs, etc.
imagizer_aws/stacks/imagizer_cluster_stack.py
The Imagizer Cluster stack includes the resources to run a full Imagizer cluster such as an Autoscaling group of Imagizer EC2s and a load balancer.
imagizer_aws/stacks/autospotting_stack.py
Significantly lowers our Amazon AWS costs by automating the use of spot instances. https://github.com/AutoSpotting/AutoSpotting
All autoscaling groups with the tag 'spot-enabled' will be subject to auto-spotting.