| Service | Log Location |
|---|---|
| CloudFormation | Stack events (Console/CLI) |
| CodeBuild | Build logs (CloudWatch Logs) |
| CodeDeploy | Deployment logs, lifecycle events |
| Elastic Beanstalk | /var/log/, eb logs |
| ECS | Task stopped reason, container logs |
| Lambda | CloudWatch Logs /aws/lambda/ |
| Error | Cause | Solution |
|---|---|---|
| CREATE_FAILED | Resource creation error | Check stack events for specific error |
| UPDATE_ROLLBACK_FAILED | Rollback stuck | continue-update-rollback --resources-to-skip |
| DELETE_FAILED | Resource can’t be deleted | Manual cleanup, retry |
| ROLLBACK_COMPLETE | Create failed, rolled back | Fix template, create new stack |
| Error | Cause | Solution |
|---|---|---|
| Hook failed | Script error in lifecycle hook | Check hook script logs |
| Health check failed | App not responding | Check app logs, health endpoint |
| AllowTraffic failed | Target group unhealthy | Check ALB health check settings |
| Timeout | Hook exceeded timeout | Increase timeout or optimize script |
| BeforeBlockTraffic failed | Lifecycle hook script error | Check script logs |
Scenario 1: CodeDeploy agent failed to start on-premises
/var/log/aws/codedeploy-agent/Scenario 2: Newly tagged instance trong deployment group
Scenario 3: Lambda deployment failure
Scenario: X-Ray tracing cho Beanstalk application
# View recent logs
eb logs
# View specific log file
eb logs --log-group /aws/elasticbeanstalk/my-env/var/log/web.stdout.log
Stopped reason: "Essential container in task exited"
Exit code: 137 → Out of memory (OOM killed)
Exit code: 1 → Application error
Exit code: 143 → SIGTERM (graceful shutdown)
| Issue | Cause | Solution |
|---|---|---|
| Alias pointing to wrong version | Misconfigured alias | Update alias to correct version |
| Deployment package too large | Package > 50MB (direct) or 250MB (S3) | Optimize dependencies, use layers |
| Environment variable error | Missing or wrong env vars | Check Lambda configuration |
eb logs cho application logsExam Tip:
eb logs, X-Ray daemon auto-runs khi enabled