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?

4 minute read
0

I want to increase the available disk space on my Amazon Elastic Container Service (Amazon ECS) container instance. I manually launched my Amazon ECS cluster with an Auto Scaling group.

Short description

Important: The following steps terminate the original container instances in your Amazon ECS cluster. Any data that's stored on the Amazon Elastic Block Store (Amazon EBS) volumes for those instances is lost when you complete these procedures.

To increase the storage space on your container instances, update the launch configuration or launch template to increase the volume size of your Amazon EBS. Then, replace your original instances with new instances from your Auto Scaling group.

If you used a different method to launch your container instances, then complete the steps in either of the following articles:

Note: Your Amazon EBS volume configuration varies based on the Amazon ECS-optimized Amazon Machine Image (AMI) that you use. For more information, see Configure storage.

Resolution

Important: To avoid downtime for your Amazon ECS services, launch your replacement instances before you drain your original container instances. After all the tasks stop on the original container instances, confirm that the tasks on the replacement instances start. Then, terminate the original container instances.

Create an Auto Scaling group with a launch template. Then, drain your original ECS container instances and migrate your containers to the new instances.

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.

Create a new Auto Scaling group from a launch template

  1. 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.
    Note: When you create the Auto Scaling group, use the new version of the template.
  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 instances

  1. Open the Amazon ECS console.
  2. Choose the cluster where your container instance is grouped.
  3. Choose Infrastructure, and then select the original container instances by the instance IDs that you noted earlier.
  4. 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. The container instances are replaced based on 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 wait for these tasks to finish or manually stop them.
  5. When the DRAINING instances have 0 running tasks, repeat steps 2-3 until all of the original container instances are in DRAINING status.
  6. Delete the original Auto Scaling group to terminate the original instances.

Related information

Container instance draining

Storage options for your Amazon ECS tasks

AWS OFFICIAL
AWS OFFICIALUpdated a month ago