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?

4 minute read
0

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.    (New EC2 Experience) Choose Actions, choose Image and templates, and then choose Launch more like this.
(Old EC2 console) Choose Actions, and then choose Launch more like this.

Note: The Launch more like this option pre-populates the Launch an instance window 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 mappings.

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 cluster in which your container instance is grouped.

3.    (New ECS Experience) Choose the Infrastructure tab, and then select the original container instances by the instance IDs that you noted earlier.
(Old ECS console) Choose the ECS Instances tab, 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 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.

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.    Terminate the original instances.

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


Related information

AMI storage configuration

Container instance draining

Using data volumes in tasks

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago