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?
Last updated: 2019-09-05
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?
To increase the storage space on your container instances, you must update the launch configuration to increase the volume size of your Amazon Elastic Block Store (Amazon EBS), and then replace your original instances with new instances from your Auto Scaling group.
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 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 which 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.
Create a new Auto Scaling group from your original launch configuration
Important: 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.
- Open the Amazon EC2 console.
- From the navigation pane, choose Auto Scaling Groups.
Note: In the Launch Configuration column, note the name of the launch configuration for the Auto Scaling group with the ECS container instances where you want to increase disk space.
- From the navigation pane, choose Launch Configurations.
- Select the launch configuration for your existing ECS container instance, choose Actions, and then choose Copy launch configuration.
- Choose Edit storage.
- To increase the size of your volume, enter a value for Size (GiB).
Note: For more information on volume options, see Block Device Mapping.
- Choose Skip to review, and then choose Create launch configuration.
- Choose Create an Auto Scaling group using this launch configuration.
- After your new instances launch, open the Amazon ECS console, and then choose Clusters.
- 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 instances
- Open the Amazon ECS console.
- Choose the ECS Instances tab, and then select the original container instances.
- 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.
- When the DRAINING instances have 0 running tasks, repeat steps 2 and 3 until all the original container instances are in DRAINING status.
- Delete the original Auto Scaling group to terminate the original instances.
Your tasks are now running on the new instances with more storage available.