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

asked 2 years ago3536 views
1 Answer
3
Accepted Answer

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
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.

Guidelines for Answering Questions