Pages

Showing posts with label mfa. Show all posts
Showing posts with label mfa. Show all posts

Wednesday, December 1, 2021

AWS CLI using Role and MFA

 AWS CLI using Role and MFA

1. Setting AWS CLI Credential location : ~/.aws/credentials

[myuser]
aws_access_key_id = xxxx
aws_secret_access_key = xxxx


2. Setting AWS CLI Config location : ~/.aws/config

[profile myusermfa]
region = yourregion
role_arn = arn:aws:iam::xxAccountIDxx:role/xxRoleNamexx
source_profile = myuser
mfa_serial = arn:aws:iam::xxAccountIDxx:mfa/myuser
role_session_name = Session_MyUser_MFA

3. Access AWS CLI using profile

aws s3 ls s3:// --profile=myuser

ShareThis