AWS Management — Assuming role in AWS CLI with MFA authentication.

  1. We use normal profile to get session Token, with MFA authentication.
  2. We create temp profile for MFA authenticated session.
  3. We authenticated and assume desired role with that profile and add role profile to .aws/credentials file
  4. Then, we can start using it in any aws cli command with --profile argument
  5. What information we need:
  1. Now we are getting MFA authentication session object, and parsing it to extract:
  2. aws_access_key_id
  3. aws_secret_access_key
  4. aws_session_token

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store