AWS CLI 관련 명령어

slee2·2022년 10월 16일
0

자주 사용하는 명령어

aws sts get-caller-identity # 엑세스 키에 대한 정보
aws ec2 describe-key-pairs # 키 페어에 대한 정보

config 파일 설정

위치 - .aws/config

[default]
aws_access_key_id=[AWS 엑세스 키 ID] 
aws_secret_access_key=[AWS 엑세스 키 SECRET]
region=ap-northeast-2
output = json

[profile test1]
aws_access_key_id=[AWS 엑세스 키 ID] 
aws_secret_access_key=[AWS 엑세스 키 SECRET]
region=eu-west-1
output = json
  • AWS 계정을 하나만 사용한다면 default로 사용해도 되고, 여러 계정을 관리해야한다면 밑에 추가하여 profile 관리가 가능하다.
    • 단, default를 제외하고 이름 앞에 profile을 붙여야 된다.
  • output
    • none, json, table, text, yaml 등 여러 포맷을 지원함
    • 키 페어 정보를 어떻게 출력할지 선택

profile 관련 명령어

aws configure get region --profile test1 # 이름이 test1인 profile의 region 출력
$> eu-west-1
aws configure get region # 현재 profile의 region 출력
$> ap-northeast-2
export AWS_PROFILE=test1 # 이름이 test1인 profile로 변경
aws configure get region
$> eu-west-1

0개의 댓글