Question: 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 Elastic Container Service (Amazon ECS) container instances if I launched my Amazon ECS cluster manually with an Auto Scaling group?Short descriptionTo increase the storage space on your container instances, you must update the launch configuration or launch template to increase the volume size of your Amazon Elastic Block Store (Amazon EBS). Then, replace your original instances with new instances from your Auto Scaling group.To increase a container instance's storage space through this method, complete the steps below. 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 ECS cluster from the AWS Management Console?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 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 is lost when you complete these procedures.

ResolutionImportant: To avoid downtime for your Amazon ECS services, you must launch replacement instances before draining your original container instances. After all the tasks stop on the original container instances, confirm that the tasks on the replacement instances started, and then terminate the original container instances.First, create an Auto Scaling group with either a launch template or launch configuration.Note: To use the latest features from Amazon Elastic Compute Cloud (Amazon EC2), it's a best practice to use launch templates instead of configurations.(Option 1) Create a new Auto Scaling group from a launch template1.    Open the Amazon EC2 console.2.    From the navigation pane, choose Auto Scaling Groups. In the Launch template/configuration column, note the name of the launch template for any ECS container instance where you want to increase disk space.3.    From the navigation pane, choose Launch Templates.4.    Select the launch template for your existing ECS container instance, choose Actions, and then choose Modify template (Create new version).5.    Under Storage (volumes), expand the details for the EBS volume and enter a value for Size (GiB).Note: For more information on volume options, see Block device mappings.6.    Choose Create template version.7.    Under Create an Auto Scaling group from your template, choose Create Auto Scaling group.8.    When creating the Auto Scaling group, make sure that you are using the new version of the template.9.    After your new instances launch, open the Amazon ECS console, and then choose Clusters.10.    To verify that the new instances appear, select your cluster, and then choose the ECS Instances tab.(Option 2) Create a new Auto Scaling group from your original launch configuration1.    Open the Amazon EC2 console.2.    From the navigation pane, choose Auto Scaling Groups. In the Launch template/configuration column, note the name of the launch template/configuration for any ECS container instance where you want to increase disk space.3.    From the navigation pane, choose Launch Configurations.4.    Select the launch configuration for your existing ECS container instance, choose Actions, and then choose Copy launch configuration.5.    To increase the size of your volume, enter a value for Size (GiB).Note: For more information on volume options, see Block device mappings.6.    Choose Create launch configuration.7.    Select the newly created launch configuration, and choose Actions. Then, choose Create Auto Scaling group.8.    After your new instances launch, open the Amazon ECS console, and then choose Clusters.9.    To verify that the new instances appear, select your cluster, and then choose the ECS Instances tab.Drain your original ECS container instances and migrate your containers to new instances1.    Open the Amazon ECS console.2.    Choose the ECS Instances tab, and then select the original container instances.3.    Choose Actions, and then choose Drain 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 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 wait for these tasks to finish or stop them manually.4.    When the DRAINING instances have 0 running tasks, repeat steps 2 and 3 until all the original container instances are in DRAINING status.5.    Delete the original Auto Scaling group to terminate the original instances.6.    Your tasks are now running on the new instances with more storage available.

Related informationContainer instance drainingUsing data volumes in tasks