aws logs tail: Stream CloudWatch Logs in CI
Tail or fetch recent CloudWatch Logs for a log group from the CLI.
aws logs tail prints recent CloudWatch Logs events for a group and can follow them live. In CI it surfaces Lambda, ECS, or application logs right after a deploy to verify behavior or capture failure output without opening the console.
Common flags
--follow- stream new events as they arrive--since 10m- start from a relative time (e.g. 1h, 30m)--filter-pattern "ERROR"- only show matching events--format short- compact output without metadata
Example in CI
Pull the last 5 minutes of error logs after a deploy.
shell
aws logs tail /aws/lambda/my-api --since 5m --filter-pattern "ERROR"Common errors in CI
- An error occurred (ResourceNotFoundException) - log group does not exist yet
- An error occurred (AccessDeniedException) - role lacks logs:GetLogEvents/FilterLogEvents
- No output - events have not propagated yet, or --since window is too short
Key takeaways
- aws logs tail fetches recent events; add --follow to stream live.
- Use --since and --filter-pattern to scope a post-deploy log check in CI.
- A missing log group (ResourceNotFoundException) usually means it has not been invoked yet.
Related guides
aws lambda invoke: Invoke a Lambda Function in CIaws lambda invoke runs a Lambda function and captures its response. Learn the payload, log-type, and cli-bina…
aws ecs describe-services: Check ECS Rollout in CIaws ecs describe-services reports the status, deployments, and running counts of ECS services. Use it in CI t…
aws ec2 describe-instances: Query EC2 in CIaws ec2 describe-instances lists EC2 instances with filtering and JMESPath queries. Learn the filters and que…