brew install --cask aws-vault
# 기존에 awsudo를 사용한 경우, 기존 설정과 인증서 삭제
rm ~/.aws/config ~/.aws/credentials
$ aws-vault add ${AWS_PROFILE}
Enter Access Key Id: ...
Enter Secret Key: ...
Shift + Cmd + G
(Go to Folder 창 띄우기)/Users/유저이름/Library/Keychains
입력 후 Enter
aws-vault.keychain-db
키체인 파일 더블 클릭
우클릭
Change Settings for Keychain “aws-vault”…
클릭600 입력하고 저장 (600분 = 10시간)
cat <<EOF >> ~/.aws/config
[default]
region=ap-northeast-2
output=table
[profile rolroralra]
region=ap-northeast-2
output=table
mfa_serial=arn:aws:iam::xxxxxxxxxxxx:mfa/rolroralra
credential_process = aws-vault exec --json --prompt=osascript rolroralra
source_profile = rolroralra
EOF
cat <<EOF >> ~/.zshrc
# AWS
export AWS_PROFILE=rolroralra
export AWS_SESSION_TOKEN_TTL=10h
eval "$(aws-vault --completion-script-zsh)"
EOF
$ aws-vault exec rolroralra -- aws s3 ls
$ aws s3 ls