Why can't my ECS service register available EC2 instances with my ELB?

后端 未结 6 1931
盖世英雄少女心
盖世英雄少女心 2020-12-10 03:41

I\'ve got an EC2 launch configuration that builds the ECS optimized AMI. I\'ve got an auto scaling group that ensures that I\'ve got at least two available instances at all

6条回答
  •  有刺的猬
    2020-12-10 04:08

    I had similar symptoms but ended up finding the answer in the log files:

    /var/log/ecs/ecs-agent.2016-04-06-03:

    2016-04-06T03:05:26Z [ERROR] Error registering: AccessDeniedException: User: arn:aws:sts:::assumed-role//
    

    In my case, the resource existed but was not accessible. It sounds like OP is pointing at a resource that doesn't exist or isn't visible. Are your clusters and instances in the same region? The logs should confirm the details.

    In response to other posts:

    You do NOT need public IP addresses.

    You do need: the ecsServiceRole or equivalent IAM role assigned to the EC2 instance in order to talk to the ECS service. You must also specify the ECS cluster and can be done via user data during instance launch or launch configuration definition, like so:

    #!/bin/bash
    echo ECS_CLUSTER=GenericSericeECSClusterPROD >> /etc/ecs/ecs.config
    

    If you fail to do this on newly launched instances, you can do this after the instance has launched and then restart the service.

提交回复
热议问题