Skip to content

EC2 TerminateInstances fails with InternalError for DRAINING ECS instances

0

We have EC2 instances used as ECS container instances in DRAINING with 0 running tasks. TerminateInstances fails from both CLI and Console with: “InternalError: An internal error has occurred”.

Region: me-south-1 Instances are DRAINING, 0 tasks, agent disconnected. CloudTrail shows errorCode=Server.InternalError on TerminateInstances.

Is there any workaround to force terminate under a Basic support plan, or must we upgrade to technical support?

1 Answer
0

Based on the information available, when you encounter an InternalError during EC2 instance termination for DRAINING ECS instances, this indicates an AWS service-side issue rather than a configuration problem on your end.

For instances in DRAINING state with 0 running tasks and a disconnected agent, the normal termination process should work. When you encounter a Server.InternalError in CloudTrail, this suggests a temporary service issue that may resolve itself.

Here are some approaches you can try without requiring a support plan upgrade:

  1. Wait and Retry: Internal errors are often transient. Wait a few minutes and attempt the termination again through either the CLI or Console.

  2. Deregister the Container Instance First: Before terminating, try deregistering the container instance from your ECS cluster. Once deregistered, the instance status changes to INACTIVE, and you may have better success terminating it afterward.

  3. Check Auto Scaling Group Settings: If these instances are part of an Auto Scaling group, verify that they don't have scale-in protection enabled, which could interfere with termination attempts.

  4. Review Instance State: Ensure the EC2 instance itself isn't in a problematic state (like stopping or pending) that might cause termination conflicts.

However, if the InternalError persists across multiple attempts and time periods, this likely requires AWS engineering investigation. While Basic support doesn't include technical support cases, persistent service errors affecting your ability to manage resources may warrant upgrading to at least Developer support to open a case, as this appears to be a service-side issue rather than a usage question.

The me-south-1 region specification is noted, though internal errors can occur in any region and typically require AWS intervention to resolve if they persist.
Sources
Troubleshoot EC2 instance termination in Amazon ECS | AWS re:Post
Amazon ECS EC2 Container Instances - Amazon Elastic Container Service

answered a month ago
AWS
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.