Question: How do I increase the available disk space on my Amazon ECS container instances if I launched my ECS cluster from the AWS Management Console?

How do I increase the total disk space on my Amazon Elastic Container Service (Amazon ECS) container instances if I launch my ECS cluster from the AWS Management Console?Short descriptionTo increase the storage space on your container instances, you must launch replacement instances, and then terminate your original instances.To increase the storage space using this method, complete the steps in the Resolution section. If you launched your container instances using another method, then skip this article and complete the steps in one of the following articles:How do I increase the available disk space on my Amazon ECS container instances if I launched my cluster manually with an Auto Scaling group?How do I increase the available disk space on my Amazon ECS container instances if I launched my container instances as standalone Amazon EC2 instances?Note: Your Amazon Elastic Block Store (Amazon EBS) volume configuration varies depending on the Amazon ECS optimized Amazon Machine Image (AMI) that you're using. For more information and commands on how to check the available space on your instances, 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 will be lost when you complete these steps.

ResolutionUpdate the storage size and launch replacement instancesOpen the Amazon ECS console, and then identify the name of the ECS cluster where you want to launch your new container instances.Identify the instances that are running in your Auto Scaling group.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.Choose Actions, and then choose Update Stack.In the Select Template section, choose Use current template, and then choose Next.Set the EBsVolumeSize parameter to the new size required for your instances in GB.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, and 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.Set the DeviceName for your Amazon Linux version.Step through the rest of the setup wizard by choosing Next for each page, and then choose Update to launch your new replacement instances.Now, the launch configuration for your Auto Scaling group is updated to the new storage configuration. This increased configuration also applies to any new instances that are launched by the Auto Scaling group.Terminate your original instancesImportant: To be sure that your services remain available, you must drain the container instances to reschedule your tasks, and then terminate your original instances in batches. You can also automate this draining workflow when an instance is terminated.Open the Amazon ECS console, identify the first batch of instances that are running in your Auto Scaling group, and then drain your instances in this batch.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 and replaced according to the service's deployment configuration parameters, minimumHealthyPercent and maximumPercent. Any PENDING or RUNNING tasks that don't belong to the service are unaffected. You must either wait for these tasks to finish or stop them manually.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.Repeat steps 1-2 until you replace all the original instances with your new container instances.Your tasks should now be running on the new instances with more storage available.

Related informationAMI storage configurationUsing data volumes in tasks