AWS Cloud Development Kit with Python
1.1K
AWS Cloud Development Kit with Python & AWS CLI
These instructions will cover usage information and for the docker container
In order to run this container you'll need docker installed.
Run the following in a newly created or existing project directory.
Refer to Run aws-cdk with AWS environment variables below for passing environment variables.
Bash will keep the container running.
docker run --name aws-cdk -it -d -v $(pwd):/user-app gclim/aws-cdk-python bash
Note: For initiating a new CDK project only.
docker exec -t aws-cdk cdk init app --language=python
Initiating terminal session with the aws-cdk docker container.
docker exec -ti aws-cdk bash
Note: For initiating a new CDK project only within the docker container.
cdk init --language python
cdk [diff|deploy|list|help]
Refer to CDK guide to get started
https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html
For configuring AWS credentials either on the docker host or within aws-cdk docker container.
Note: Not required if using AWS environment variables.
aws configure
Run the following in a newly created or existing project directory.
Bash will keep the container running.
docker run \
--name aws-cdk -it -d -v $(pwd):/user-app \
-e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
-e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
gclim/aws-cdk-python bash
Then use docker exec -ti aws-cdk bash for interactive session.
Run the following in a newly created or existing project directory.
The container will terminate after completion of the process.
Refer to CDK document for list of commands, or use help.
docker run \
--rm -v $(pwd):/user-app \
-e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
-e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
gclim/aws-cdk-python [diff|deploy|list|help]
Run the following to start Docker container.
Bash will keep the container running.
docker run \
--name aws-cdk -it -d \
-e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
-e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
gclim/aws-cdk-python bash
Run the following to clone the project from GItHub.
docker exec -it aws-cdk git clone https://github.com/username/project_name.git .
Run the following to update the dependencies.
docker exec -it aws-cdk pip install -r requirements.txt
Run the following to provision AWS using CDK.
docker exec -it aws-cdk cdk deploy
Single command line to clone, pip install requirements and deploy.
The container will terminate after completion of the process.
docker run --rm -it \
-e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
-e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
gclim/aws-cdk-python /bin/bash -c "git clone https://github.com/username/project_name.git .; pip install -r requirements.txt; cdk deploy"
By default, Docker waits 10 seconds before killing it.
Use -t option to set wait time.
docker stop aws-cdk
/user-app - user app directory for CDK project/root/.aws - aws profiles and credentialsContent type
Image
Digest
Size
115.9 MB
Last updated
over 5 years ago
docker pull gclim/aws-cdk-python