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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ