How to add EC2 to existing ECS cluster?

0

Hi there,

I am trying to add an ec2 instance in to an ecs cluster, I tried to follow this guild https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html , but i could not make it working.

here is my ec2 config:

EC2:
    Type: AWS::EC2::Instance
    Properties: 
      ImageId: ami-0d5564ca7e0b414a9
      InstanceType: g4dn.xlarge
      KeyName: tmp-key
      SubnetId: !Ref PrivateSubnetOne
      SecurityGroupIds: !Ref ContainerSecurityGroup
      UserData: 
        Fn::Base64:
          !Sub |
          #!/bin/bash
          echo ECS_CLUSTER=traffic-data-cluster >> /etc/ecs/ecs.config
          echo ECS_ENABLED_GPU_SUPPORT=true >> /etc/ecs/ecs.config

Thank for your help

질문됨 2년 전3560회 조회
1개 답변
3
수락된 답변

Hello

I think you have missed the IAM Roles to the Ec2, Please check the reference link Github

 - arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role
  - arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM
profile picture
전문가
GK
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠