This project is designed to help you complete your AWS Week 30 & 31 modules. It integrates several core AWS services into a single, functional application.
- DynamoDB: Real-time visitor counter.
- SQS: Task queuing for background processing.
- SNS: Critical security alert notifications.
- Secrets Manager: Securely fetching API keys/config.
- AppConfig: Dynamic "Maintenance Mode" toggles.
- CodeBuild: Automatic Docker image builds via
buildspec.yml. - ECR/ECS: Containerization and orchestration.
Follow these steps in your AWS Console to make the application fully functional:
- Create a table named
VisitorCount. - Partition Key:
id(String). - Once created, add an item:
{ "id": "global_stats", "visitor_count": 0 }.
- Create a Standard Queue named
MyOrderQueue. - Copy its URL and add it to your environment variables.
- Create a Standard Topic named
MyAlerts. - Create a Subscription (Protocol: Email) and confirm the link in your inbox.
- Copy the Topic ARN for your configuration.
- Create a secret named
AppSecretKeys. - Select "Other type of secret" and add key-value pairs (e.g.,
api_key: sample_key).
- Application:
MyFlaskConfig - Environment:
Production - Configuration Profile:
MaintenanceMode - Add a JSON configuration:
{ "maintenance_mode": false }.
python3 -m venv venvsource venv/bin/activatepip install -r requirements.txt- Set your environment variables in a
.envfile or export them:export AWS_REGION="us-east-1" export DYNAMODB_TABLE="VisitorLogs" export SQS_QUEUE_URL="https://sqs.us-east-1.amazonaws.com/246005668592/MyOrderQueue" export SNS_TOPIC_ARN="arn:aws:sns:us-east-1:246005668592:MyAlerts"
python app.py
docker build -t aws-flask-app .docker run -p 8080:8080 -e AWS_ACCESS_KEY_ID=XXX -e AWS_SECRET_ACCESS_KEY=XXX aws-flask-app
The provided buildspec.yml is ready!
- Create a project in AWS CodeBuild.
- Connect it to your GitHub repository.
- Select "Docker" as the environment and enable the "Privileged" flag.
- Add environment variables:
AWS_ACCOUNT_ID,IMAGE_REPO_NAME, andCONTAINER_NAME.