kkamagi's story

IT, 정보보안, 포렌식, 일상 공유

AWS

[AWS CLI] ecs service container의 IP가져오기

까마기 2020. 7. 17. 15:40
반응형

 

 

# aws ec2 describe-instances --filters "Name=tag:Name,Values=ECS Instance - EC2ContainerService-cilkroad-exchange" |jq '.Reservations[].Instances[0] | select(.State.Name == "running")' |jq '.PrivateIpAddress'

 

 

  • aws ec2 describe-instances 명령어를 사용하여 우선 특정 instance의 value를 확인

  • 예) 결과

    • "Value": "EC2ContainerService-cilkroad-exchange",

    •                             "Key": "aws:cloudformation:stack-name"

    •                         },

    •                         {

    •                             "Value": "This instance is the part of the Auto Scaling group which was created through ECS Console",

    •                             "Key": "Description"

    •                         },

    •                         {

    •                             "Value": "arn:aws:cloudformation:ap-northeast-2:549074364751:stack/EC2ContainerService-cilkroad-exchange/1804b050-656a-11e9-8b3e-0a9c42377702",

    •                             "Key": "aws:cloudformation:stack-id"

    •                         },

    •                         {

    •                             "Value": "ECS Instance - EC2ContainerService-cilkroad-exchange",

    •                             "Key": "Name"

    •                         },

    •                         {

    •                             "Value": "EC2ContainerService-cilkroad-exchange-EcsInstanceAsg-16KP29IICRL1W",

    •                             "Key": "aws:autoscaling:groupName"

    •                         },

    •                         {

    •                             "Value": "EcsInstanceAsg",

    •                             "Key": "aws:cloudformation:logical-id"

    • --

 

반응형

'AWS' 카테고리의 다른 글

AWS ECS 컨테이너 인스턴스 연결 해제  (0) 2020.10.26
AWS ECS  (0) 2020.10.26
AWS SES(Simple Mail Service)  (0) 2020.10.26
AWS SSL 인증서 갱신  (0) 2020.08.26
AWS 인프라 아키텍쳐 교육  (0) 2020.07.17