Search code examples
amazon-web-servicescommand-linehomebrewassume-role

Enter 'assume-role'' in terminal not working, display killed message


I have a project that will need to use assume-role to get AWS permissions.

Usually I will use the command eval $(assume-role -duration 8h0m0s profile_name) to get permission, and the terminal will prompt me to enter the MFA verification code after inputting

But after I upgraded Mac OS13, this command doesn't work anymore

I tried using assume-role to make sure it worked, but got a response like [1] 35413 killed assume-role.

Also I have confirmed with aws sts get-caller-identity that I have the correct AWS role.

I also reinstalled assume-role via brew and upgraded brew at the same time.

I would like to ask how to fix this problem? Thanks


Solution

  • I resolved it by using AWS CLI: like below command

    eval $(aws sts assume-role --profile {{YOUR_PROFILE}} --role-arn {{YOUR_ROLE_ARN}} --role-session-name {{CUSTOM_SESSION_NAME}}
    --serial-number {{YOUR_SERIAL}} --duration-seconds 28800 --token-code {{YOUR_MFA_CODE}} | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=\(.AccessKeyId)\nexport AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey)\nexport AWS_SESSION_TOKEN=\(.SessionToken) AWS_SECURITY_TOKEN=\(.SessionToken)\n"')
    

    You can check these info in .aws/config and .aws/credentials