Returns a signed JSON Web Token (JWT) that represents the calling Amazon Web Services identity or, if you set SubjectMode to OriginIdentity , the human user or workload on whose behalf the calling session acts. The returned JWT can be used to authenticate with external services that support OIDC discovery. The token is signed by Amazon Web Services STS and can be publicly verified using the verification keys published at the issuer’s JWKS endpoint.
The sub (subject) claim contains the identity that SubjectMode selects. Whichever subject mode you use, the principal_id claim under the https://sts.amazonaws.com/ namespace contains the ARN of the principal that requested the token, when that principal has an ARN. For a role session, this is the ARN of the role.
GetWebIdentityToken API is not available on the STS Global endpoint.See also: AWS API Documentation
get-web-identity-token
--audience <value>
[--duration-seconds <value>]
--signing-algorithm <value>
[--scope <value>]
[--subject-mode <value>]
[--tags <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]
--audience (list) [required]
The intended recipient of the web identity token. This value populates the
audclaim in the JWT and should identify the service or application that will validate and use the token. The external service should verify this claim to ensure the token was intended for their use.Constraints:
- min:
1- max:
10(string)
Constraints:
- min:
1- max:
1000
Syntax:
"string" "string" ...
--duration-seconds (integer)
The duration, in seconds, for which the JSON Web Token (JWT) will remain valid. The value can range from 60 seconds (1 minute) to 3600 seconds (1 hour). If not specified, the default duration is 300 seconds (5 minutes). The token is designed to be short-lived and should be used for proof of identity, then exchanged for credentials or short-lived tokens in the external service.
Constraints:
- min:
60- max:
3600
--signing-algorithm (string) [required]
The cryptographic algorithm to use for signing the JSON Web Token (JWT). Valid values are RS256 (RSA with SHA-256) and ES384 (ECDSA using P-384 curve with SHA-384).
Constraints:
- min:
5- max:
5
--scope (string)
One or more OAuth 2.0 scope values to include in the JSON Web Token (JWT). Amazon Web Services STS copies the value exactly as you send it into the top-level
scopeclaim of the token. If you don’t specifyScope, the token doesn’t include ascopeclaim.Separate multiple values with a single space, as defined in RFC 6749, section 3.3 on the IETF website. Don’t begin or end
Scopewith a space. Each scope value can contain printable ASCII characters except spaces, double quotation marks ("), commas (,), and backslashes (\).You can’t repeat a scope value. Scope values are case sensitive. This means that
readandREADare separate values.You can specify
Scopeonly whenSubjectModeisOriginIdentityand you request exactly one audience. To specifyScope, the calling principal must have permission for thests:SetWebIdentityTokenScopeaction in addition tosts:GetWebIdentityToken. You can use the multivaluedsts:IdentityTokenScopecondition key in a policy to control which scope values a principal can request.Constraints:
- min:
1- max:
256- pattern:
[\x21\x23-\x2B\x2D-\x5B\x5D-\x7E]+( [\x21\x23-\x2B\x2D-\x5B\x5D-\x7E]+)*
--subject-mode (string)
Specifies which identity STS puts in the
sub(subject) claim of the JSON Web Token (JWT). Valid values areAWSIdentityandOriginIdentity. If you don’t specify a value, Amazon Web Services STS usesAWSIdentity.
AWSIdentity– Thesubclaim contains the ARN of the calling Amazon Web Services principal.OriginIdentity– Thesubclaim contains the value of theaws:OriginIdentity/Subjectkey in the trusted identity propagation context of the calling session. For example, this can identify the human user or workload on whose behalf the calling session acts. Amazon Web Services STS also adds asubject_modeclaim to the token. To useOriginIdentity, the trusted identity propagation context of the calling session must contain theaws:OriginIdentity/Subjectkey and either theaws:OriginIdentity/Issuerkey or theaws:OriginIdentity/FederatedProviderArnkey. If it doesn’t, or if the subject is blank, Amazon Web Services STS rejects the request with a validation error. Amazon Web Services STS denies the request if the subject begins with the textarn:, in any combination of uppercase and lowercase letters. Amazon Web Services STS also denies the request if the subject begins or ends with a space, or contains a control, format, or separator character other than a space.You can use the
sts:SubjectModecondition key in a policy to control which subject modes a principal can request.Possible values:
AWSIdentityOriginIdentity
--tags (list)
An optional list of tags to include in the JSON Web Token (JWT). These tags are added as custom claims to the JWT and can be used by the downstream service for authorization decisions.
Constraints:
- max:
50(structure)
You can pass custom key-value pair attributes when you assume a role or federate a user. These are called session tags. You can then use the session tags to control access to resources. For more information, see Tagging Amazon Web Services STS Sessions in the IAM User Guide .
Key -> (string) [required]
The key for a session tag.
You can pass up to 50 session tags. The plain text session tag keys can’t exceed 128 characters. For these and additional limits, see IAM and STS Character Limits in the IAM User Guide .
Constraints:
- min:
1- max:
128- pattern:
[\p{L}\p{Z}\p{N}_.:/=+\-@]+Value -> (string) [required]
The value for a session tag.
You can pass up to 50 session tags. The plain text session tag values can’t exceed 256 characters. For these and additional limits, see IAM and STS Character Limits in the IAM User Guide .
Constraints:
- min:
0- max:
256- pattern:
[\p{L}\p{Z}\p{N}_.:/=+\-@]*
Shorthand Syntax:
Key=string,Value=string ...
JSON Syntax:
[
{
"Key": "string",
"Value": "string"
}
...
]
--cli-input-json | --cli-input-yaml (string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.
--generate-cli-skeleton (string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.
--debug (boolean)
Turn on debug logging.
--endpoint-url (string)
Override command’s default URL with the given URL.
--no-verify-ssl (boolean)
By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.
--no-paginate (boolean)
Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.
--output (string)
The formatting style for command output.
--query (string)
A JMESPath query to use in filtering the response data.
--profile (string)
Use a specific profile from your credential file.
--region (string)
The region to use. Overrides config/env settings.
--version (string)
Display the version of this tool.
--color (string)
Turn on/off color output.
--no-sign-request (boolean)
Do not sign requests. Credentials will not be loaded if this argument is provided.
--ca-bundle (string)
The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.
--cli-read-timeout (int)
The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.
--cli-connect-timeout (int)
The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.
--cli-binary-format (string)
The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.
--no-cli-pager (boolean)
Disable cli pager for output.
--cli-auto-prompt (boolean)
Automatically prompt for CLI input parameters.
--no-cli-auto-prompt (boolean)
Disable automatically prompt for CLI input parameters.
--cli-error-format (string)
The formatting style for error output. By default, errors are displayed in enhanced format.
--help (boolean)
Display help for the command/subcommand.
WebIdentityToken -> (string)
A signed JSON Web Token (JWT) that represents the caller’s Amazon Web Services identity or, if you setSubjectModetoOriginIdentity, the human user or workload on whose behalf the calling session acts. The token contains standard JWT claims such as subject, audience, expiration time, and additional identity attributes added by STS as custom claims. These can include theprincipal_idclaim, which contains the ARN of the principal that requested the token, whichever subject mode you use. You can also add your own custom claims to the token by passing tags as request parameters to theGetWebIdentityTokenAPI. The token is signed using the specified signing algorithm and can be verified using the verification keys available at the issuer’s JWKS endpoint.
Expiration -> (timestamp)
The date and time when the web identity token expires, in UTC. The expiration is determined by adding theDurationSecondsvalue to the time the token was issued. After this time, the token should no longer be considered valid.