FeodorFitsner / cdk-python-web-apps

Python based web apps deployed to Lambda with AWS CDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cdk-python-web-apps

Python based Web apps, built with custom Docker containers, deployed to AWS with CDK.

What is this for?

This repository details ways to deploy Python Web frameworks (e.g. Flask) as standalone functions with AWS CDK. Connections to the applications are proxied through API Gateway.

Getting started

For up to date info see the AWS CDK getting started guide.

  1. npm install -g aws-cdk
  2. Activate a python virtual environment and install the CDK dependencies. (Using pyenv)
pyenv virtualenv 3.9.11 awscdk
pyenv local awscdk
pip install --upgrade pip
pip install -r requirements.txt
  1. cdk bootstrap aws://ACCOUNT-NUMBER/REGION (e.g. cdk bootstrap aws://1234567890/us-east-1)
  2. Make sure Docker is installed and running.

Manifest

Deploy

# Deploy all at once
cdk deploy --require-approval never --all --concurrency 5 --profile <your AWS profile>

# Individual app deployment
cdk deploy --require-approval never CdkLambdaPython39Flask --profile <your AWS profile>
cdk deploy --require-approval never CdkLambdaPython39FastAPI --profile <your AWS profile>
cdk deploy --require-approval never CdkEcsFargatePython310Flask --profile <your AWS profile>
cdk deploy --require-approval never CdkLambdaPython311Flask --profile <your AWS profile>
cdk deploy --require-approval never CdkLambdaPython311FastAPI --profile <your AWS profile>
cdk deploy --require-approval never CdkLambdaPython311Django --profile <your AWS profile>

Destroy

yes | cdk destroy --all

Note: Instructions and configurations were built on MacOS 12.3.x with an M1 processor. Docker commands and containers were built for platform: linux/amd64.

About

Python based web apps deployed to Lambda with AWS CDK

License:MIT License


Languages

Language:Python 71.7%Language:Dockerfile 13.1%Language:Shell 11.0%Language:HTML 4.2%