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?

Short Description

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:

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.

Resolution

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.

  1. Open the Amazon EC2 console.
  2. 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.
  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. Choose Edit storage.
  6. To increase the size of your volume, enter a value for Size (GiB).
    Note: For more information on volume options, see Block Device Mapping.
  7. Choose Skip to review, and then choose Create launch configuration.
  8. Choose Create an Auto Scaling group using this launch configuration.
  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.

Drain your original ECS container instances and migrate your containers to new instances

  1. 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.

Your tasks are now running on the new instances with more storage available.


Did this article help you?

Anything we could improve?


Need more help?