ECS Managed Instances is a capacity provider type where AWS provisions and manages EC2 instances on your behalf. Unlike the EC2 Auto Scaling capacity provider, you do not create or operate an Auto Scaling Group — instead, you describe the compute requirements and AWS handles the rest.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/terraform-aws-modules/terraform-aws-ecs/llms.txt
Use this file to discover all available pages before exploring further.
How it differs from EC2 Auto Scaling
| EC2 Auto Scaling | ECS Managed Instances | |
|---|---|---|
| Infrastructure management | You create and manage the ASG | AWS provisions and manages instances |
| Instance selection | Fixed instance type per ASG | Flexible instance requirements (CPU, memory, family) |
| IAM setup | Instance profile on ASG launch template | Infrastructure role + node role created by module |
| Security group | Managed externally | Created by cluster module, configured via inputs |
requires_compatibilities | ["EC2"] | ["MANAGED_INSTANCES"] |
ECS Managed Instances uses
MANAGED_INSTANCES in requires_compatibilities and EC2 as the launch_type. Both must be set when deploying services onto this capacity provider.IAM role requirements
The cluster module creates two IAM roles automatically when using a managed instances capacity provider: Infrastructure role (create_infrastructure_iam_role = true by default)
Used by ECS to provision, manage, and terminate EC2 instances on your behalf.
Node role (create_node_iam_instance_profile = true by default)
Attached to the EC2 instances as an instance profile, providing permissions for the container agent running on the instances.
You can bring your own roles by setting create_infrastructure_iam_role = false and providing infrastructure_iam_role_arn, or by setting create_node_iam_instance_profile = false and providing the ARN via ec2_instance_profile_arn inside the instance_launch_template.
Configuring instance requirements
Instead of specifying a single instance type, you define requirements and ECS selects matching instances. Theinstance_requirements block mirrors the EC2 Fleet attribute-based instance selection API.
Key instance requirement fields
CPU and memory
CPU and memory
min and max bounds on vCPU count and memory in MiB. ECS selects instances within these ranges.Instance generations and CPU manufacturers
Instance generations and CPU manufacturers
instance_generations = ["current"] to exclude previous-generation instance types. cpu_manufacturers accepts intel, amd, and amazon-web-services (for Graviton).Specific instance types
Specific instance types
allowed_instance_types to constrain to a specific list instead of using attribute-based selection.Network configuration
Specify which subnets the managed instances should be launched into:Storage configuration
Set the root volume size for the managed instances:Security group setup
The cluster module creates a security group for the managed instances whencreate_security_group = true (the default). Configure ingress and egress rules via security_group_ingress_rules and security_group_egress_rules:
vpc_id so the module can create the security group in the correct VPC.
Deploying a service onto managed instances
Services targeting a managed instances capacity provider setrequires_compatibilities = ["MANAGED_INSTANCES"] and launch_type = "EC2". Reference the capacity provider by name from the cluster outputs:
Complete example
The following shows the full cluster + service configuration from themanaged-instances example:

