How to Get More Out of Your ECS Cluster | Container Density | A Beginner's Guide to awsvpcTrunking

2 minute read
Content level: Foundational

Traditional Amazon ECS deployments on EC2 instances have a limitation on the number of Elastic Network Interfaces (ENIs) per instance. This restricts the number of tasks you can efficiently pack onto a single container instance, especially for microservices architectures with numerous lightweight tasks. Scaling your ECS cluster then requires more EC2 instances, increasing costs and management complexity.


Amazon ECS offers an account setting called awsvpcTrunking that allows you to significantly increase the number of ENIs available on supported EC2 instance types. This enables you to pack more tasks onto each container instance, potentially reducing the overall number of instances needed in your cluster and leading to cost savings and simpler management.

Increasing task density with ENI Trunking

There are Multiple ways you can enable this feature.

Lets start with How to Enable awsvpcTrunking using AWS Console: ?

  • Go to the Amazon ECS service console.
  • Navigate to the "Clusters" section and select your desired cluster.
  • Click on the "Settings" tab.
  • Under "Account Settings," locate "awsvpcTrunking."
  • Set the value to "enabled" and click "Save."

How to Enable awsvpcTrunking using AWS CLI ?

aws ecs put-account-setting --name awsvpcTrunking --value enabled --region <your-region> Replace <your-region> with the region you are using.

How to Enable awsvpcTrunking using Cloudformation ?

  "Resources": {
    "MyCluster": {
      "Type": "AWS::ECS::Cluster",
      "Properties": {
        "ClusterName": "MyCluster",
        "AccountSettings": [
            "Name": "awsvpcTrunking",
            "Value": "enabled"

How to Enable awsvpcTrunking using Terraform ?

resource "aws_ecs_cluster" "my_cluster" {
  name = "MyCluster"

  setting {
    name  = "awsvpcTrunking"
    value = "enabled"


Increasing Amazon ECS Linux container instance network interfaces: Optimizing Amazon ECS task density using awsvpc network mode: