티스토리 뷰

공부

[aws] emr active cluster `/etc/hosts`

승가비 2022. 12. 19. 16:30
728x90
aws emr list-clusters --active | 
  jq -r ".Clusters[].Id" | 
    while read id ; do 
      dns=$(aws emr describe-cluster --cluster-id $id |
        jq -r ".Cluster.MasterPublicDnsName")
      dns=$(echo $dns | 
        sed -r "s/ip-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.ap-northeast-2\.compute\.internal/\1.\2.\3.\4/g")
      
      name=$(aws emr describe-cluster --cluster-id $id |
        jq -r ".Cluster.Name")
      
      echo $dns $name
    done
# sudo vi /etc/hosts

1.2.3.4 emr-asdf

https://docs.aws.amazon.com/ko_kr/emr/latest/ManagementGuide/emr-manage-view-clusters.html

 

클러스터 상태 및 세부 정보 보기 - Amazon EMR

상태별로 클러스터를 나열하려면 list-clusters 명령을 --cluster-states 파라미터와 함께 사용합니다. : 시작, 부트스트랩, 실행, 대기, 종료, 종료 및 종료_WITH_ERRORS. aws emr list-clusters --cluster-states TERMINATE

docs.aws.amazon.com

https://superuser.com/questions/513412/how-to-match-digits-followed-by-a-dot-using-sed

 

How to match digits followed by a dot using sed?

I'm trying to use sed to substitute all the patterns with digits followed immediately by a dot (such as 3., 355.) by an empty string. So I try: sed 's/\d+\.//g' file.txt But it doesn't work. Why is

superuser.com

 

728x90
댓글