First, see our recent blog post at https://aws.amazon.com/blogs/containers/graceful-shutdowns-with-ecs/.
During a deployment, ECS will create new tasks, and begin the shutdown process of older tasks. The older tasks will be sent a SIGTERM signal, which could be caught by the application and arrange for orderly shutdown. Older tasks will also be deregistered from any load balancers. Once the final session has ended, the application must exit.
Once the SIGTERM is sent, there is a configurable grace period after which ECS sends a SIGKILL (non-interruptible termination) to the task containers. On EC2 this can be a practically unlimited time, but on Fargate, there is a 120 second limit at this time. (We have a PFR to extend this.) So, after 120 seconds, the Fargate task will be forcibly terminated.
If the customer needs a longer grace period, we recommend using EC2 for the time being. Otherwise, if the customer wants to stay on Fargate, they will need some sort of out-of-band signaling mechanism for communicating shutdown that is based on a more complex automation than ECS deployment.
Scaling ECS Fargate - graceful session drainingAccepted Answerasked 2 years ago
How to login to NICE DCV session?Accepted Answerasked 2 months ago
How to change default Windows resolution? (Autologon resolution without active rdp session, e.g. for UI test automation with selenium)asked 9 months ago
How to have more than two simultaneous RDP sessions to my Windows Server 2019 instance ?Accepted Answerasked 5 months ago
AWS Fargate Spot - Automated Draining for Spot SupportAccepted Answerasked 3 years ago
Customer with Multiple Users Needs Concurrent Access to Application and DatabaseAccepted Answerasked 3 years ago
Create a desktop session from Amazon Linux 2 to a windows machineasked 9 months ago
Run RDP Client on MacBookasked a month ago
Why can I not RDP into my Windows EC2asked a year ago
Which service/process deems when to kill an ongoing AppStream session?asked 17 days ago