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?
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:
- 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 cluster manually with an Auto Scaling group?
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.
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.
- Open the Amazon EC2 console.
- From the navigation pane, choose Instances.
- In the Instance ID column for each of your original ECS container instances, note the instance ID.
- Select one of your original container instances.
- 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.
- Choose the Step 4: Add Storage page.
- For Size (GiB), enter a value to increase the size of your volume.
Note: For more information on volume options, see Block Device Mapping.
- (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.
- (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.
- Choose Review and Launch, and then choose Launch.
Drain the previous ECS container instances to migrate containers to new instances
- Open the Amazon ECS console.
- Choose the ECS Instances tab, and then select the original container instances by the instance IDs that you noted earlier.
- 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-3 until all of the original container instances are in DRAINING status.
- Terminate the original instances.
Your tasks should now be running on the new instances with more storage available.