Skip to content

Error when try verify from the ECS instance

0

I am trying to connect to an ECS task. The EC2 instance is in a public subnet, and the security group allows outbound traffic to any IP, as shown in the attached image. The task definition is configured to enable command execution.

Enter image description here

However, when I attempt to connect using the following AWS command, I encounter an error.

Enter image description here

In the task definition, I am using the awsvpc network mode.

Do you have any suggestions for resolving this error? Thank you.

2 Answers
2
Accepted Answer

Hello.

If it is not an ECS network problem, the IAM policy required for the task roll may be missing, as described in the document below.
https://repost.aws/knowledge-center/ecs-error-execute-command

There is also a tool called Amazon ECS Exec Checker, so I recommend that you use it to troubleshoot.
https://github.com/aws-containers/amazon-ecs-exec-checker

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
0

Other reason too, was:

When hosting tasks that use the awsvpc network mode on Amazon EC2 Linux instances, your task ENIs aren't given public IP addresses. To access the internet, tasks must be launched in a private subnet that's configured to use a NAT gateway. For more information, see NAT gateways in the Amazon VPC User Guide. Inbound network access must be from within a VPC that uses the private IP address or routed through a load balancer from within the VPC. Tasks that are launched within public subnets do not have access to the internet.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking-awsvpc.html

answered 2 years 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.