How do I increase the available disk space on my Amazon ECS container instances when I launch my ECS cluster from the AWS Management Console?

4 minuti di lettura

I want to increase available disk space on my Amazon Elastic Container Service (Amazon ECS) container instance that I launched from the AWS Management Console.

Short description

To increase the storage space on your container instances, first launch replacement instances. Then, terminate your original instances.

If you used a different method to launch your instances, then complete the steps in one of the following articles based on your use case:

Note: Your Amazon Elastic Block Store (Amazon EBS) volume configuration can vary depending on the Amazon ECS optimized Amazon Machine Image (AMI) that you use. For more information, see AMI Storage Configuration.


Important: The following steps terminate the original container instances in your Amazon ECS cluster. Any data that's stored on the EBS volumes for those instances is lost after you complete the following steps.

Update the storage size and launch replacement instances

  1. Open the Amazon ECS console, and then select the ECS cluster where you want to launch your new container instances.
  2. Note the instances that are running in your Auto Scaling group.
  3. Open the AWS CloudFormation console, and then select the stack for your ECS cluster.
    Note: The stack name is in the following format: EC2ContainerService-yourEcsClusterName.
  4. Choose Actions, and then choose Update Stack.
  5. In the Select Template section, choose Use current template, and then choose Next.
  6. Set the EBsVolumeSize parameter to the new size required for your instances in GB.
  7. Set the AsgMaxSize parameter to increase the size of the Auto Scaling group, and then launch new replacement instances.
    Note: For Amazon ECS optimized Amazon Linux 1 AMIs, use /dev/xvda for the operating system. Also, use /dev/xvdcz for Docker images and metadata with logical volume management (LVM) devices. For Amazon ECS optimized Amazon Linux 2 AMIs, use /dev/xvda for the operating system and for Docker images and metadata.
  8. Set the DeviceName for your Amazon Linux version.
  9. Complete the setup wizard. Then, choose Update to launch your new replacement instances.

After you do this, the launch configuration for your Auto Scaling group is updated to the new storage configuration. This increased storage configuration applies to any new instances that are launched by the Auto Scaling group.

Terminate your original instances

Important: To be sure that your services remain available, first drain the container instances to reschedule your tasks. Then, terminate your original instances in batches. You can also automate this draining workflow when an instance is terminated.

  1. Open the Amazon ECS console.
  2. Select the first batch of instances that are running in your Auto Scaling group, and then drain this batch of instances.
    Note: You can drain the previous instances in batches to avoid downtime for your Amazon ECS services. When you drain service tasks for container instances, container instances that are in the RUNNING state are stopped. Then, the container instances are replaced according to the service's deployment configuration parameters, minimumHealthyPercent and maximumPercent. Any PENDING or RUNNING tasks that don't belong to the service aren't affected. You must either wait for these tasks to finish or manually stop them.
  3. After all the tasks on the container instance are stopped, terminate the container instance.
    Note: After several minutes, the underlying Auto Scaling group launches a replacement instance with increased storage to replace the terminated instance.
  4. Repeat the preceding steps until you replace all the original instances with your new container instances.

Related information

Storage options for your Amazon ECS tasks

AWS UFFICIALEAggiornata un mese fa