EC2 is not attached while creating ECS Cluster with EC2

0

Hi Team,

I deployed complete new ECS cluster with EC2 with Amazon AMI2, but i can see EC2 is deployed but its not attached with ECS. Any idea how to fix this issue?

asked 2 months ago118 views
2 Answers
1

Could you please check this steps from AWS to troubleshoot the issue :- https://repost.aws/knowledge-center/ecs-instance-unable-join-cluster

Use the AWSSupport-TroubleshootECSContainerInstance AWS Systems Manager runbook to troubleshoot the common issues that are listed in the Short description section. If the runbook's output doesn't provide recommendations, then use the manual troubleshooting approaches the following Resolution sections.

Use the Systems Manager Automation runbook
Use the AWSSupport-TroubleshootECSContainerInstance runbook to troubleshoot the EC2 instance that fails to register with the ECS cluster. This automation checks for potential issues with the following resources:

The user data for the instance contains the correct cluster information.
The instance profile contains the required permissions.
The network is correctly configured
Note: Be sure to use the AWSSupport-TroubleshootECSContainerInstance runbook in the same AWS Region where your ECS Cluster and EC2 instance are located.

Open the AWS Systems Manager console.
In the navigation pane, under Change Management, choose Automation.
Choose Execute automation.
Choose the Owned by Amazon tab.
Under Automation document, search for TroubleshootECSContainerInstance.
Select the AWSSupport-TroubleshootECSContainerInstance card.
Note: Select the radio button and not the hyperlinked automation name.
Choose Next.
For Execution automation document, choose Simple execution.
In the Input parameters section, for AutomationAssumeRole, enter the Amazon Resource Name (ARN) of the role that allows Systems Manager Automation to perform actions.
Note: If you don't specify an IAM role, then Systems Manager Automation uses the permissions of the IAM user or role that runs the runbook. For more information about creating the assume role for Systems Manager Automation, see Method 2: Use IAM to configure roles for Automation. Be sure that the AutomationAssumeRole or the IAM role has the following permissions: ec2:DescribeIamInstanceProfileAssociations, ec2:DescribeInstanceAttribute, ec2:DescribeInstances, ec2:DescribeNetworkAcls, ec2:DescribeRouteTables, ec2:DescribeSecurityGroups, ec2:DescribeSubnets, ec2:DescribeVpcs, ec2:DescribeVpcEndpoints, iam:GetInstanceProfile, iam:GetRole, iam:SimulateCustomPolicy, and iam:SimulatePrincipalPolicy.
For ClusterName, enter the cluster name where the EC2 instance failed to register.
For InstanceId, enter the EC2 Instance ID that failed to register.
Choose Execute.
The runbook's output provides troubleshooting steps and recommendations.

Verify the status of the Amazon ECS agent on the Amazon Linux 2 instance
Run the following command to check whether the Amazon ECS container agent on the instance is running:
profile picture
EXPERT
answered 2 months ago
1

There are many reasons why here’s a few to list.

  • EC2 can’t connect to endpoint.
  • EC2 doesn’t have correct role
  • Security groups do not allow access
  • ACLs do not allow access.
profile picture
EXPERT
answered 2 months 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.

Guidelines for Answering Questions