aws sts get-session-token

From wikieduonline
Jump to navigation Jump to search

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/sts/get-session-token.html

aws sts get-session-token --profile "$1"  --serial-number "$2" --token-code $MFA_CODE
  • Duration: 12 hours (43,200 seconds) as the default. Valid range: 15 minutes to 36 hours (129,600 seconds).

Examples

  • aws sts get-session-token --serial-number <mfa_device> --token-code <token>
  • aws sts get-session-token --serial-number arn:aws:iam::62405745487395:mfa/yourname --token-code 123456
  • aws sts get-session-token --serial-number arn:aws:iam::62405745487395:mfa/yourname --duration-seconds 129600 --token-code 123456
  • aws sts get-session-token --serial-number arn:aws:iam::62405745487395:mfa/yourname --duration-seconds 129600 --token-code 123456 --output text

Synopsys

  get-session-token
[--duration-seconds <value>]
[--serial-number <value>]
[--token-code <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Example

aws sts get-session-token \
    --duration-seconds 900 \
    --serial-number "arn:aws:iam::62405745487395:mfa/yourname" \
    --token-code 123456

{
    "Credentials": {
        "AccessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY",
        "SessionToken":  "AQoEXAMPLEH4aoAH0gNCAPyJxz4BlCFFxWNE1OPTgk5TthT+FvwqnKwRcOIfrRh3c/LTo6UDdyJwOOvEVPvLXCrrrUtdnniCEXAMPLE/IvU1dYUg2RVAJBanLiHb4IgRmpRV3zrkuWJOgQs8IZZaIv2BXIa2R4OlgkBN9bkUDNCJiBeb/AXlzBBko7b15fjrBs2+cTQtpZ3CYWFXG8C5zqx37wnOE49mRl/+OtkIKGO7fAE",
       "Expiration": "2020-05-19T18:06:10+00:00"
   }
}

Errors

Related terms

Activities

See also

Advertising: