Skip to content

How do I respond to an Amazon ECS task retirement notification for an AWS Fargate task?

3 minute read
0

I received a notification about an upcoming routine retirement of my Amazon Elastic Container Service (Amazon ECS) tasks that run on AWS Fargate. I want to respond to this task retirement notification.

Short description

To control when your task retirement or replacement occurs, replace your tasks before the task retirement date. For information about task retirement notifications, see Improving operational visibility with AWS Fargate task retirement notifications. For information about task retirement maintenance, see Task retirement and maintenance for AWS Fargate on Amazon ECS.

For service tasks, you don't need to take action unless you must replace the tasks before the task retirement date. For standalone tasks, you must replace the tasks yourself.

To retire or restart your Amazon ECS tasks before the routine task retirement, take one of the following actions:

To replace your tasks before the task retirement date, take one of the following actions:

  • Manually update Amazon ECS
  • Replace standalone tasks

To specify when Fargate retires tasks in future task retirement notifications, take one of the following actions:

  • Modify the task retirement wait time
  • Use EC2 event windows to schedule task retirements

Note: You can't change the task retirement date after AWS sends the notification. Changes to the task retirement wait period or to event windows apply only to retirements that AWS schedules after you make the changes.

Manually update Amazon ECS

To relocate running tasks, use the console, or AWS CLI.

Use the console

To use the console, see Updating an Amazon ECS service.

Use the CLI

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

For services that use Amazon ECS deployment controller, update the service before the task retirement date. Run the following update-service AWS CLI command with the force-new-deployment parameter:

aws ecs update-service --service service-name --cluster cluster-name --force-new-deployment 

Note: Replace service-name with the name of the affected service and cluster-name with the cluster name.

For services that use AWS CodeDeploy deployment controller, create a new deployment in AWS CodeDeploy that uses the same task definition revision.

If you have a rolling update deployment, set the minimumHealthyPercent value to 100 and maximumPercent value to 200.

Replace standalone tasks

Fargate stops the standalone task on or after the task retirement date. When a task is stopped, Amazon ECS doesn't launch a replacement task. If a task must continue to run, then stop the running task and launch a replacement task before the task retirement date.

Modify the task retirement wait time

To specify when Fargate retires the task in future task retirement notifications, use the fargateTaskRetirementWaitPeriod account settings option.

Use EC2 event windows to schedule task retirements

To specify when Fargate retires your tasks, see Create custom event windows for scheduled events that affect your Amazon EC2 instances. For more information, see Step 1: Set the task wait time or use Amazon EC2 event windows.

If AWS Fargate retires your tasks outside of your event windows, then expand the event window duration or increase event window frequency. For more information, see Prepare for AWS Fargate task retirement on Amazon ECS.

AWS OFFICIALUpdated 4 days ago