Use Amazon EBS volumes with Amazon ECS - Amazon Elastic Container Service

Use Amazon EBS volumes with Amazon ECS

Amazon Elastic Block Store (Amazon EBS) volumes provide highly available, cost-effective, durable, high-performance block storage for data-intensive workloads. Amazon EBS volumes can be used with Amazon ECS tasks for high throughput and transaction-intensive applications.

During standalone task launch, you can provide the configuration that will be used to attach one EBS volume to the task. During service creation or update, you can provide the configuration that will be used to attach one EBS volume per task to each task managed by the ECS service.

By providing volume configuration at launch time rather than in the task definition, you create task definitions that aren't constrained to a specific data volume type or specific EBS volume settings. You can then reuse your task definitions across different runtime environments. For example, you can provide more throughput during deployment for your production workloads then your pre-prod environments.

Amazon EBS volumes that are attached to Amazon ECS tasks are managed by Amazon ECS on your behalf. The volumes can be encrypted with AWS Key Management Service (AWS KMS) keys to protect your data. You can either configure new, empty volumes for attachment, or you can use snapshots to load data from existing volumes.

To monitor your volume's performance, you can also use Amazon CloudWatch metrics. For more information about Amazon ECS metrics for Amazon EBS volumes, see Amazon ECS CloudWatch metrics and Amazon ECS Container Insights metrics.

For more information about Amazon EBS volumes, see Amazon EBS volumes in the Amazon EBS User Guide.

AWS Regions and Availability Zones for Amazon EBS volumes

Amazon EBS volumes can be attached to Amazon ECS tasks in the following AWS Regions:

Region name Region code

US East (N. Virginia)

us-east-1

US East (Ohio)

us-east-2

US West (N. California)

us-west-1

US West (Oregon)

us-west-2

Africa (Cape Town)

af-south-1

Asia Pacific (Hong Kong)

ap-east-1

Asia Pacific (Hyderabad)

ap-south-2

Asia Pacific (Jakarta)

ap-southeast-3

Asia Pacific (Melbourne)

ap-southeast-4

Asia Pacific (Mumbai)

ap-south-1

Asia Pacific (Osaka)

ap-northeast-3

Asia Pacific (Seoul)

ap-northeast-2

Asia Pacific (Singapore)

ap-southeast-1

Asia Pacific (Sydney)

ap-southeast-2

Asia Pacific (Tokyo)

ap-northeast-1

Canada (Central)

ca-central-1

Europe (Frankfurt)

eu-central-1

Europe (Ireland)

eu-west-1

Europe (London)

eu-west-2

Europe (Milan)

eu-south-1

Europe (Paris)

eu-west-3

Europe (Spain)

eu-south-2

Europe (Stockholm)

eu-north-1

Europe (Zurich)

eu-central-2

Middle East (Bahrain)

me-south-1

Middle East (UAE)

me-central-1

South America (São Paulo)

sa-east-1
Important

You can't configure Amazon EBS volumes for attachment to Fargate Amazon ECS tasks in the euc1-az2 and use1-az3 Availability Zones.

Amazon EBS volume considerations

Consider the following when using Amazon EBS volumes:

  • Amazon EBS volumes are supported only for Linux tasks hosted on Fargate, and EC2 launch type tasks hosted on Nitro-based Linux instances with Amazon ECS-optimized Amazon Machine Images (AMIs). For more information about instance types, see Instance types in the Amazon EC2 User Guide. For more information about Amazon ECS launch types, see Amazon ECS launch types.

  • For tasks that are hosted on Fargate, Amazon EBS volumes are supported on platform version 1.4.0 or later (Linux). For more information, see Fargate Linux platform versions.

  • For tasks that are hosted on Amazon EC2 Linux instances, Amazon EBS volumes are supported on ECS-optimized AMI 20231219 or later. For more information, see Retrieving Amazon ECS-Optimized AMI metadata.

  • The magnetic (standard) Amazon EBS volume type is not supported for tasks hosted on Fargate. For more information about Amazon EBS volume types, see Amazon EBS volumes in the Amazon EC2 User Guide.

  • An Amazon ECS infrastructure IAM role is required when creating a service or a standalone task that is configuring a volume at deployment. You can attach the AWS managed AmazonECSInfrastructureRolePolicyForVolumes IAM policy to the role, or you can use the managed policy as a guide to create and attach your own policy with permissions that meet your specific needs. For more information, see Amazon ECS infrastructure IAM role.

  • You can attach at most one Amazon EBS volume to each Amazon ECS task, and it must be a new volume. You can't attach an existing Amazon EBS volume to a task. However, you can configure a new Amazon EBS volume at deployment using the snapshot of an existing volume.

  • You can configure Amazon EBS volumes at deployment only for services that use the rolling update deployment type and the Replica scheduling strategy.

  • Amazon ECS automatically adds the reserved tags AmazonECSCreated and AmazonECSManaged to the attached volume. If you remove these tags from the volume, Amazon ECS won't be able to manage the volume on your behalf. For more information about tagging Amazon EBS volumes, see Tagging Amazon EBS volumes. For more information about tagging Amazon ECS resources, see Tagging your Amazon ECS resources.

  • Provisioning volumes from a snapshot of an Amazon EBS volume that contains partitions isn't supported.

  • Volumes that are attached to tasks that are managed by a service aren't preserved and are always deleted upon task termination.

  • You can't configure Amazon EBS volumes for attachment to Amazon ECS tasks that are running on AWS Outposts.