[ AWS CLI] AWS 계정 변경하기
aws cli를 쓰기위해서는 aws 계정에 대한 configure를 써야한다
내 경우는 dev와 prod 두가지의 계정을 바꿔써야했다
$ aws configure list
결과값
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************4541 shared-credentials-file
secret_key ****************H3R6 shared-credentials-file
region ap-northeast-2 config-file ~/.aws/config
지금 현재는 profile 이름을 지정하지 않은 default의 경우이다
$ export AWS_DEFAULT_PROFILE=iot-dev
터미널에 입력을 해준 후 다시 한번 list를 조회하면
Name Value Type Location
---- ----- ---- --------
profile iot-dev manual --profile
access_key ****************SBO4 shared-credentials-file
secret_key ****************Oqzp shared-credentials-file
region ap-northeast-2 config-file ~/.aws/config
profile value가 바뀐것을 확인 할 수 있다
매번 설정하기는 귀찮으므로 박아놓기로 한다
$ vi ~/.bash_profile
export AWS_DEFAULT_PROFILE=iot-dev 추가
껐다 켜도 되지만 바로 되기 하기 위해서 입력해준다
$ source ~/.bash_profile