How do I take action on an Amazon ECS task retirement notice for a task that runs on Fargate?

2 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 take action on this task retirement notification.

Short description

When you manually restart or retire your tasks, you avoid potential service interruptions caused by task replacement actions. 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.

When you receive a task retirement notification, you don't need to take action unless you want to retire the tasks before the task retirement date.

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

  • Modify the task retirement wait time.
  • Manually update Amazon ECS.

Resolution

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.

Modify the task retirement wait time

Use the fargateTaskRetirementWaitPeriod option to control when Fargate retires the task.

Manually update Amazon ECS

Use the Amazon ECS console to update the service.

For services that use rolling deployment, run the update-service command with the force-new-deployment option to update the service before the task retirement date:

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 blue/green deployment, you must create a new deployment in AWS CodeDeploy. You can run the create-deployment AWS CLI command.

Replace standalone tasks

For standalone tasks, Fargate stops the 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.

AWS OFFICIAL
AWS OFFICIALUpdated a month ago