A collection of configuration templates for Amazon ECS resources as well as security controls for monitoring and protecting Amazon ECS configuration such as Config Rules, CloudWatch Alarms, EventBridge Rules, IAM policies, and more.

ECS
Amazon ECS Task Definition with EC2 Compatibility

This template creates an Amazon ECS task definition with EC2 as the required compatibility. It includes container definitions, volumes, and optional properties such as mount points, entry point, memory, and CPU.

CloudFormationTerraform
Amazon ECS Task Definition

This template creates an Amazon ECS task definition with the specified container definitions and volumes. It also includes optional properties such as mount points, port mappings, entry point, memory, and CPU.

CloudFormationTerraform
ECS Service with ECS Exec Enabled

This template creates an Amazon Elastic Container Service (Amazon ECS) service with ECS Exec enabled. The service has a desired count of 1 and uses a cluster, task definition, and ECS Exec flag that are declared elsewhere in the same template.

CloudFormationTerraform
ECS Service With Health Check Grace Period

This template creates an Amazon Elastic Container Service (Amazon ECS) service with a parameter that allows users to specify the number of seconds that the service scheduler should ignore unhealthy Elastic Load Balancing target health checks after a task has first started. The service has a desired count of 0 and uses a cluster, deployment configuration, load balancer, placement strategies, placement constraints, task definition, service name, and role that are declared elsewhere in the same template.

CloudFormationTerraform
ECS Service with Application Load Balancer (ALB) Association

This template creates an Amazon Elastic Container Service (Amazon ECS) service and associates it with an Application Load Balancer. The service has a desired count of 1 and uses a cluster, task definition, and load balancer that are declared elsewhere in the same template.

CloudFormationTerraform
Basic ECS Service

This template creates an Amazon Elastic Container Service (Amazon ECS) service with a desired count of 1. It uses a cluster and task definition that are declared elsewhere in the same template.

CloudFormationTerraform
Cluster Capacity Provider Association using an AWS Fargate Capacity Provider

This template associates the FARGATE and FARGATE_SPOT capacity providers with an existing cluster. The cluster name must be specified as a parameter.

CloudFormationTerraform
Empty ECS Cluster with CloudWatch Container Insights and Tags

This template creates an empty Amazon ECS cluster named MyCluster with CloudWatch Container Insights enabled. It is also tagged with the key 'environment' and the value 'production'.

CloudFormationTerraform
ECS Cluster with ECS Exec Configuration

This template creates an Amazon ECS cluster named MyCluster with ECS Exec enabled using the default logging configuration.

CloudFormationTerraform
ECS Cluster with Fargate Capacity Providers

This template creates an Amazon ECS cluster named MyFargateCluster with the FARGATE and FARGATE_SPOT capacity providers. It also defines a default capacity provider strategy where tasks launched will be split evenly between the FARGATE and FARGATE_SPOT capacity providers.

CloudFormationTerraform
ECS Capacity Provider

This template creates an Amazon ECS capacity provider that is associated with an Auto Scaling group and used for cluster auto scaling. The capacity provider has managed scaling and managed termination protection enabled. It also includes tags for environment.

CloudFormationTerraform
ECS (Elastic Container)
ECS Task Definition with AppMesh Proxy

Configures an ECS task definition with AppMesh proxy configuration for network traffic control.

Terraform
MongoDB ECS Task Definition and Service Deployment

Defines and deploys a MongoDB service on AWS ECS using a specific task definition.

Terraform
Basic ECS Task Execution

This template retrieves data for executing a basic ECS task using FARGATE launch type.

Terraform
ECS Cluster Capacity Provider with Auto Scaling Group

This template configures an ECS cluster capacity provider linked to an Auto Scaling Group, managing scaling and termination protection settings.

Terraform
ECS Cluster with Enhanced Logging

Creates an ECS cluster with enhanced logging using AWS KMS and CloudWatch.

Terraform
ECS Cluster with Capacity Providers

Creates an ECS cluster and configures its capacity providers to use AWS Fargate with a specific strategy.

Terraform
ECS Service with Ignored Desired Count Changes

Creates an ECS service with a fixed number of instances and ignores any external changes to the desired count.

Terraform
Basic ECS Task Definition

Defines a basic ECS task with two containers, each with specific CPU and memory requirements, and essential status.

Terraform
ECS Task Definition with Inference Accelerator

Configures an ECS task definition with container settings for inference acceleration.

Terraform
ECS Task Definition for Fargate with Runtime Platform

Defines an ECS Fargate task with specific runtime platform settings for Windows Server 2019 Core.

Terraform
ECS Task Set with Scale Ignoring Changes

Configures an ECS task set to run a specified percentage of the service's desired count and ignores any external changes to the scale.

Terraform
Config Rule
ECS Task No Privileged Containers

A Config rule that checks if the privileged parameter in the container definition of ECSTaskDefinitions is set to true The rule is NON_COMPLIANT if the privileged parameter is true.

CloudFormationTerraformAWS CLI
ECS Fargate Latest Platform Version Check

A Config rule that checks if Amazon Elastic Container Service (ECS) Fargate Services is running on the latest Fargate platform version. The rule is NON_COMPLIANT if ECS Service platformVersion not set to LATEST.

CloudFormationTerraformAWS CLI
ECS Task No Environment Secrets

A Config rule that checks if secrets are passed as container environment variables. The rule is NON_COMPLIANT if 1 or more environment variable key matches a key listed in the secretKeys parameter (excluding environmental variables from other locations such as Amazon S3).

CloudFormationTerraformAWS CLI
ECS Task has Memory Hard Limit Defined

A Config rule that checks if Amazon Elastic Container Service (ECS) task definitions have a set memory limit for its container definitions. The rule is NON_COMPLIANT for a task definition if the ‘memory’ parameter is absent for one container definition.

CloudFormationTerraformAWS CLI
ECS Task Does Not Use Root User

A Config rule that checks if ECSTaskDefinitions specify a user for Amazon Elastic Container Service (Amazon ECS) EC2 launch type containers to run on. The rule is NON_COMPLIANT if the user parameter is not present or set to root.

CloudFormationTerraformAWS CLI
ECS Task Definition PID Mode Check

A Config rule that checks if ECSTaskDefinitions are configured to share a host process namespace with its Amazon Elastic Container Service (Amazon ECS) containers. The rule is NON_COMPLIANT if the pidMode parameter is set to host.

CloudFormationTerraformAWS CLI
ECS Task Networking Mode Check

A Config rule that checks if an Amazon Elastic Container Service (Amazon ECS) task definition with host networking mode has privileged or user container definitions. The rule is NON_COMPLIANT for task definitions with host network mode and container definitions of privileged=false or empty and user=root or empty.

CloudFormationTerraformAWS CLI
Check if networking mode for active ECSTaskDefinitions is set to ‘awsvpc’

Checks if the networking mode for active ECSTaskDefinitions is set to ‘awsvpc’. This rule is NON_COMPLIANT if active ECSTaskDefinitions is not set to ‘awsvpc’. This rule only evaluates the latest active revision of an Amazon ECS task definition.

CloudFormationTerraform
Check if ECS clusters have container insights enabled

Checks if Amazon Elastic Container Service clusters have container insights enabled. The rule is NON_COMPLIANT if container insights are not enabled.

CloudFormationTerraform
Check logConfiguration on active ECS Task Definitions

Checks if logConfiguration is set on active ECS Task Definitions. This rule is NON_COMPLIANT if an active ECSTaskDefinition does not have the logConfiguration resource defined or the value for logConfiguration is null in at least one container definition.

CloudFormationTerraform