AWS-CLI 계정 등록 및 전환 방법

개요

  • 신규 등록 계좌
  • 계정 전환
  • 계정 등록


    $ aws configure --profile ユーザー名                                         
    
    위 명령 실행
    $ aws configure --profile ユーザー名(test)                             
    AWS Access Key ID [None]: アクセスキー入力
    AWS Secret Access Key [None]: シークレットアクセスキー入力
    Default region name [None]: リージョン入力
    Default output format [None]: json
    
    집행 후 상술한 것이 하나하나 나타나 등록을 진행한다.
    등록이 완료되었는지 확인합니다.
     $ tree ~/.aws                                                               
    /Users/user/.aws
    ├── config
    └── credentials
    
    계층 구조 확인 후 이동
    cd /Users/user/.aws/
    
    credential의 내용 확인
    $ cat credentials                                                           
    [default(会社アカウント)]
    aws_access_key_id = XXXXXXXXXXXXXXXX
    aws_secret_access_key = XXXXXXXXXXXXXXXX
    [test]
    aws_access_key_id = SSSSSSSSSSSSSSSSSSSSSS
    aws_secret_access_key = SSSSSSSSSSSSSSSSSSSSS
    
    등록을 확인합니다.

    계정 전환


    현재 계정 확인
    $ aws configure list                                                       
          Name                    Value             Type    Location
          ----                    -----             ----    --------
       profile              会社アカウント           manual    --profile
    access_key     ****************PX7B shared-credentials-file
    secret_key     ****************9N8q shared-credentials-file
        region           ap-southeast-1      config-file    ~/.aws/config
    
    상기 명령을 실행할 때 현재 사용하는 계정 정보를 출력합니다.
    프로필을 봤는데 회사 계좌라서 이번에 만든 테스트라는 계좌로 전환해야 해요.
    $ export AWS_DEFAULT_PROFILE=ユーザー名
    
    상기 명령으로 변경할 수 있기 때문에 이번에 제작한test를 지정하여 집행한다.
    $ export AWS_DEFAULT_PROFILE=test
    
    확인
    $ aws configure list                                                                 日 12/20 02:57:33 2020
          Name                    Value             Type    Location
          ----                    -----             ----    --------
       profile                  test           manual    --profile
    access_key     ****************IEPM shared-credentials-file
    secret_key     ****************VPOT shared-credentials-file
        region           ap-northeast-1      config-file    ~/.aws/config
    
    변경 완료.

    좋은 웹페이지 즐겨찾기