I want to increase disk space for my Amazon Elastic Container Service (Amazon ECS) container on AWS Fargate.
Short description
Amazon ECS tasks that are hosted on Fargate platform version 1.4.0 or later receive at least 20 GiB of ephemeral storage. For more than 20 GiB of storage, use one of the following options:
Note: Your Amazon EFS file system and Fargate tasks must be in the same Amazon Virtual Private Cloud (Amazon VPC).
Resolution
Use Fargate ephemeral storage
You can use either version 2 of the Amazon ECS console, or AWS Command Line Interface.
Note: If you receive errors when running the AWS CLI, confirm that you're running a recent version of the AWS CLI.
Use the V2 console
Note: The ephemeral storage option isn't available in the classic console.
- Open the Amazon ECS console.
- In the navigation pane, choose Task definitions.
- Choose Create a new task definition. You can also revise an existing task definition.
- Add the required information of the container, and then choose Next.
- Under Storage, for ephemeral storage, provide the required amount of ephemeral storage. The minimum is 21 GiB and the maximum is 200 GiB.
- Choose Next, and then choose Create.
Use the AWS Command Line Interface (AWS CLI)
1. Run the register-task-definition command to create or update the task definition with increased storage up to 200 GiB. Use the --ephemeral-storage flag.
$ aws ecs register-task-definition --region <example-region> --cli-input-json file://<path_to_json>/demo.json --ephemeral-storage sizeInGiB=<example-integer>
Note: Replace example-region with your AWS Region and example-integer with your integer.
2. Describe the task definition to confirm the updated ephemeral storage.
aws ecs describe-task-definition --task-definition <example-task-definition-name> --region <example-region>
Note: Replace example-task-definition-name with your task definition name.
Example output:
"ephemeralStorage": {
"sizeInGiB": <example-value>
}
For more information on configuring ephemeral storage, see Bind mount examples.