2.2.0 CloudWatch Logs
0. Learning Materials
Video: Week 2 CloudWatch Logs
Andrew's repo: week-2-cloudwatch-logs
My branch repo: 02-02-cloudwatch-logs
Task List
2. Update the backend docker container
Env Variables
backend
HONEYCOMB_API_KEYOTEL_SERVICE_NAMEOTEL_EXPORTER_OTLP_ENDPOINTOTEL_EXPORTER_OTLP_HEADERSAWS_XRAY_URLAWS_XRAY_DAEMON_ADDRESSAWS_DEFAULT_REGIONAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
x-ray daemon
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGION
1. Workflow
1. Implement a CloudWatch agent in backend
1.1. Plant a logger in the flask server app.
The python library watchtower is a log handler for Amazon Web Services CloudWatch Logs. Run pip install to install it in local.
pip install -r requirements.txt
Update app.py by adding the following snippets across the file. Refer to the actual code here.
1.2. Set logger in the service (home_activities)
2. Update the backend docker container
The following env variables will be used by watchtower.
Now our app is ready to test the CloudWatch agent in action.
Run
docker-composethen hit some backend endpoints by clicking around in the frontend
Check your AWS CloudWatch console.

Last updated