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?

Last updated: 2019-09-05

How do I increase the available disk space on my Amazon Elastic Container Service (Amazon ECS) if I launched my container instances as standalone Amazon Elastic Compute Cloud (Amazon EC2) instances?

Short Description

To 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:

Note: Your Amazon Elastic Block Store (Amazon EBS) volume configuration varies depending on which Amazon ECS-optimized Amazon Machine Image (AMI) 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.

Resolution

Launch replacement instances

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 Instances.
  3. In the Instance ID column for each of your original ECS container instances, note the instance ID.
  4. Select one of your original container instances.
  5. Choose Actions, and then choose Launch More Like This to go to the Launch Instance Wizard.
    Note: The Launch More Like This option pre-populates the Launch Instance Wizard with the options from your original container instances. You can then update the configuration to increase the EBS volume or any other configuration updates.
  6. Choose the Step 4: Add Storage page.
  7. For Size (GiB), enter a value to increase the size of your volume.
    Note: For more information on volume options, see Block Device Mapping.
  8. (Optional) To update the number of instances that you want to launch, choose 3. Configure Instance, and then enter the number of instances for Number of instances.
  9. (Optional) To update the AMI ID to the latest Amazon ECS-optimized AMI, choose 1. Choose AMI, and then enter the AMI ID for your AWS Region.
  10. Choose Review and Launch, and then choose Launch.

Drain the previous ECS container instances to migrate containers to new instances

  1. Open the Amazon ECS console.
  2. Choose the ECS Instances tab, and then select the original container instances by the instance IDs that you noted earlier.
  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-3 until all of the original container instances are in DRAINING status.
  5. Terminate the original instances.

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


Did this article help you?

Anything we could improve?


Need more help?