Updating the Amazon ECS Container Agent on the Amazon ECS-optimized AMI
If you are using the Amazon ECS-optimized AMI, you have several options to get the latest version of the Amazon ECS container agent (shown in order of recommendation):
Terminate your current container instances and launch the latest version of the Amazon ECS-optimized AMI (either manually or by updating your Auto Scaling launch configuration with the latest AMI). This provides a fresh container instance with the most current tested and validated versions of Amazon Linux, Docker,
ecs-init, and the Amazon ECS container agent. For more information, see Amazon ECS-Optimized AMI.
Connect to the instance with SSH and update the
ecs-initpackage (and its dependencies) to the latest version. This operation provides the most current tested and validated versions of Docker and
ecs-initthat are available in the Amazon Linux repositories and the latest version of the Amazon ECS container agent. For more information, see To update the
ecs-initpackage on the Amazon ECS-optimized AMI.
Update the container agent with the
UpdateContainerAgentAPI operation, either through the console or with the AWS CLI or AWS SDKs. For more information, see Updating the Amazon ECS Container Agent with the
To update the
ecs-init package on the Amazon ECS-optimized AMI
Log into your container instance via SSH. For more information, see Connect to Your Container Instance.
ecs-initpackage with the following command.Copy
sudo yum update -y ecs-init
ecs-initpackage and the Amazon ECS container agent are updated immediately; however, newer versions of Docker are not loaded until the Docker daemon is restarted (either by rebooting the instance, or by running sudo service docker restart to restart Docker and then sudo start ecs to restart the container agent).
Updating the Amazon ECS Container Agent with the
UpdateContainerAgent API Operation
This update process is only supported on the Amazon ECS-optimized AMI. For container instances that are running other operating systems, see Manually Updating the Amazon ECS Container Agent (for Non-Amazon ECS-optimized AMIs).
To update the Amazon ECS agent version from versions prior to v1.0.0 on your Amazon ECS-optimized AMI we recommend that you terminate your current container instance and launch a new instance with the most recent Amazon ECS-Optimized AMI. Any container instances that use a preview version of the Amazon ECS-optimized AMI should be retired and replaced with the most recent AMI. For more information, see Launching an Amazon ECS Container Instance.
The update process begins when you request an agent update, either through the
console or with the AWS CLI or AWS SDKs. Amazon ECS checks your current agent version
against the latest available agent version, and if an update is possible, the
update process progresses as shown in the flow chart below. If an update is not
available, for example, if the agent is already running the most recent version,
NoUpdateAvailableException is returned.
The stages in the update process shown above are as follows:
An agent update is available, and the update process has started.
The agent has begun downloading the agent update. If the agent cannot download the update, or if the contents of the update are incorrect or corrupted, then the agent sends a notification of the failure and the update transitions to the
The agent download has completed and the agent contents have been verified.
ecs-initservice is restarted and it picks up the new agent version. If the agent is for some reason unable to restart, the update transitions to the
FAILEDstate; otherwise, the agent signals Amazon ECS that the update is complete.
To update the Amazon ECS container agent on the Amazon ECS-optimized AMI in the console
Open the Amazon ECS console at https://console.aws.amazon.com/ecs/.
On the Clusters page, select the cluster that hosts the container instance or instances to check.
On the Cluster :
cluster_namepage, choose ECS Instances.
Select the container instance to update.
On the Container Instance page, choose Update agent.
To update the Amazon ECS container agent on the Amazon ECS-optimized AMI with the AWS CLI
Use the following command to update the Amazon ECS container agent on your container instance:Copy
aws ecs update-container-agent --cluster