Production-ready 3-tier application with Flask backend, RDS PostgreSQL, DynamoDB, ElastiCache, and Lambda.
Internet
↓
NLB (Public Subnet) - Port 80
↓
Frontend EC2 (Private) - nginx
↓ (reverse proxy)
Backend EC2 (Private) - Flask:5000
↓
RDS PostgreSQL | ElastiCache Redis | DynamoDB | S3 | SNS
Infrastructure already created via AWS Console ✓
Next steps:
- Initialize PostgreSQL database
- Deploy backend on EC2
- Deploy frontend on EC2
- Create NLB
- Deploy Lambda functions
See SETUP_GUIDE.md for complete deployment instructions.
sample-app/
├── backend/
│ ├── app.py # Flask application
│ └── Dockerfile
├── frontend/
│ └── index.html # Web interface
├── lambda/
│ ├── handler.py # API Lambda
│ └── sns_handler.py # SNS handler
├── config/
│ └── config.py # AWS clients config
├── scripts/
│ └── init_postgres.sql # Database schema
├── cloudformation.yml # Infrastructure template
├── SETUP_GUIDE.md # Deployment guide
├── requirements.txt # Python dependencies
└── .env.example # Environment template
GET /users
POST /usersGET /orders
POST /ordersGET /healthAWS_REGION=us-east-1
DYNAMODB_TABLE=users_table
POSTGRES_HOST=<RDS_ENDPOINT>
POSTGRES_DB=appdb
POSTGRES_USER=postgres
POSTGRES_PASSWORD=<PASSWORD>
REDIS_HOST=<REDIS_ENDPOINT>
REDIS_PORT=6379
S3_BUCKET=<S3_BUCKET>
SNS_TOPIC_ARN=<SNS_ARN>
SES_FROM_EMAIL=<EMAIL>
Follow SETUP_GUIDE.md for:
- Part 2: Initialize PostgreSQL
- Part 3: Deploy Backend EC2
- Part 4: Deploy Frontend EC2
- Part 5: Deploy Lambda Functions
# Backend health
curl http://<backend-ip>:5000/health
# Frontend
curl http://<nlb-dns>/
# Lambda API
curl https://<api-id>.execute-api.us-east-1.amazonaws.com/prod/health- Delete NLB from EC2 Console
- Terminate EC2 instances
- Delete Lambda functions
- Delete API Gateway
- Delete CloudFormation stack (removes all infrastructure)
See SETUP_GUIDE.md for detailed instructions and troubleshooting.