The steps outlined below define the procedure for assuming roles across
accounts. These steps assume that the user has MFA enabled, is in the
appropriate role on the trusted account, and has the appropriate trust policy
attached to the role being assumed.
Assume Role
Environment variables may need to be unset before calling aws sts assume-role
--role-arn : Amazon Resource Number for role being assumed
--serial-number : Amazon Resource Number of user’s MFA device
*--role-session-name : Temporary session identifier
*--token-code : Token code from user’s MFA device
The --duration-seconds parameter is used to specify the duration of the role
session, from 900 seconds (15 minutes) up to the Maximum CLI/API session
duration setting for the role. If you specify a value for the DurationSeconds
parameter that is higher than the maximum setting, the operation fails. The
default session duration is 3600 (1 hour).