AWS CloudWatch Logs Integration
What you'll learn: How to forward logs from AWS services like Lambda, ECS, EKS, and EC2 into CloudWatch Logs for centralized storage and analysis.
The Central Log Hub
Think of CloudWatch Logs as AWS's built-in log warehouse. Instead of SSH-ing into individual servers or hunting through container logs, you send everything to one searchable location. This is the AWS-native way to implement the centralized logging patterns you've learned.
How Each Service Connects
Lambda Functions automatically send logs to CloudWatch Logs by default—every print() or console.log() statement appears in a log group named /aws/lambda/your-function-name.
ECS Tasks use the awslogs log driver in your task definition. You specify a log group, and the container's stdout and stderr stream directly to CloudWatch.
EKS Clusters require a logging agent like Fluent Bit (which you've learned) deployed as a DaemonSet. It collects container logs from /var/log/containers and forwards them to CloudWatch via the AWS API.
EC2 Instances need the CloudWatch Agent installed. You configure it to tail specific log files (like /var/log/application.log) and ship them to designated log groups.
The Pattern
The consistent pattern: Service → Log Stream → Log Group → CloudWatch Logs. Each resource creates a log stream within a log group, organizing your logs hierarchically. You can then query with CloudWatch Insights, set metric filters to create alarms, or export to S3 for long-term retention.
This integration bridges your application logging with AWS's native observability tools, applying the structured logging and log shipping principles you've already mastered to AWS-specific infrastructure.
Key Takeaway: CloudWatch Logs centralizes logs from Lambda, ECS, EKS, and EC2 using service-specific methods—built-in streaming for Lambda, log drivers for ECS, agent deployments for EKS/EC2—creating a unified AWS-native logging destination.