AWS Secrets should not be passed as container environment variables

Description

This assessment verifies whether the environment parameter in container definitions includes key values such as AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, or ECS_ENGINE_AUTH_DATA. This evaluation does not extend to environmental variables sourced from external locations like Amazon S3. It is focused solely on the latest active revision of an Amazon ECS task definition.

Utilizing AWS Systems Manager Parameter Store can enhance the security posture of your organization. We recommend leveraging the Parameter Store to securely store secrets and credentials instead of directly embedding them in container instances or hardcoding them in your code.

Remediation

From the console

To create parameters using SSM, see Creating Systems Manager parameters in the AWS Systems Manager User Guide. For more information about creating a task definition that specifies a secret, see Specifying sensitive data using Secrets Manager in the Amazon Elastic Container Service Developer Guide.