This is a minimal docker image runs flask connects to AWS and uses RDS
/S3
/API Gateway
/CloudFront
/etc. Details are shown below in FUNCTION and PROFILER area.
This architecture is designed to provide a handy way to deploy an app, you can completely remove docker based back-end server and replace by a serverless method.
- An AWS Free-tier account
- Knowledge of S3/RDS/CloudFront/API Gateway
- Docker
- Patience
$ cp ./.env.example ./.env && vim ./.env # first of all, you need to edit enviroment varibales to yours
$ chmod 777 ./deploy.sh
$ ./deploy.sh
- Upload/download images to/from S3 from API Gateway deployed on AWS
- RDS to store image path data
- Single domain with CloudFront CDN service
- S3 (only
get
andput
are allowed): https://euqn60nqt1.execute-api.ap-northeast-1.amazonaws.com/v1/docker-flask-s3-bucket/test.png - RDS: docker-flask-db.ccct0eee47fu.ap-northeast-1.rds.amazonaws.com
- CloudFront: https://d1w4is3fbx4jrr.cloudfront.net/
I use two method: API Gateway/ Cloudfront + API Gateway to request for images which are stored in S3-bucket. Below compare two methods, as you can see: CDN responses more efficiently.