Checks that all ECS task definitions have a defined logging configuration to enable appropriate logging and monitoring of container activities.
Rule | ECS task definitions should have a logging configuration |
Framework | AWS Foundational Security Best Practices |
Severity | ✔ High |
Rule Description:
When defining ECS task definitions on AWS, it is essential to include a logging configuration to comply with Amazon Web Services Foundational Security Best Practices. Implementing proper logging ensures that vital information and data about the tasks are captured, stored, and easily accessible for security monitoring and auditing purposes.
Troubleshooting Steps:
If logging configuration is missing in the ECS task definitions, follow these steps to remediate the issue:
Necessary Codes:
To add logging configuration to an ECS task definition, you can utilize the following JSON snippet as an example:
{ "containerDefinitions": [ { "name": "your-container-name", "image": "your-container-image", "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "/ecs/your-log-group", "awslogs-region": "your-aws-region", "awslogs-stream-prefix": "your-stream-prefix" } } } ] }
Ensure to replace placeholders like "your-container-name," "your-container-image," "your-log-group," "your-aws-region," and "your-stream-prefix" with appropriate values specific to your setup.
Step-by-Step Guide for Remediation:
By following these steps and including logging configuration in ECS task definitions, you ensure compliance with AWS Foundational Security Best Practices and enhance the security posture of your ECS workloads.