How can I increase disk space for my Amazon ECS container on AWS Fargate?

2 minute read
0

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.

  1. Open the Amazon ECS console.
  2. In the navigation pane, choose Task definitions.
  3. Choose Create a new task definition. You can also revise an existing task definition.
  4. Add the required information of the container, and then choose Next.
  5. Under Storage, for ephemeral storage, provide the required amount of ephemeral storage. The minimum is 21 GiB and the maximum is 200 GiB.
  6. 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.

AWS OFFICIAL
AWS OFFICIALUpdated a year ago