<a id="cli-aws-sts-issue-workload-identity-context"></a>

# issue-workload-identity-context

## Description

Issues a workload identity context for a workload that an Amazon Web Services service runs for you. The service passes the context to  AssumeRole in `ProvidedContexts` to get temporary security credentials for the workload. The resulting role session has the workload identity. If the workload identity provider uses the SPIFFE naming scheme, your workload can then call  GetCertificate , or  GetWebIdentityToken with a `TokenType` of `JWT_SVID` .

Amazon Web Services services that run workloads call this operation with their own service credentials. You don’t call it yourself. The service describes the workload in an attestation document, and names a workload identity template in `WorkloadIdentityTemplateArn` . Amazon Web Services STS builds the identity of the workload from the template and the attested values.

The service must also name the account and the resource that it acts for, which Amazon Web Services STS makes available as the `aws:SourceAccount` and `aws:SourceArn` condition keys. For a template that an account owns, the source account must be that account. For one that an organization owns, the source account must be a member of that organization.

Amazon Web Services STS issues the context only if the template has an attestation policy, and that policy allows the calling service to issue it for the attested values. The attestation policy sees each attested value as a condition key whose name begins with `aws:WorkloadAttestation/aws/` . If the policy doesn’t allow the request, or the template doesn’t exist, the request fails with `AccessDenied` .

A context can be redeemed only by the service that requested it, with the same source account and source ARN, only for the role in `TargetRoleArn` , and only until `Expiration` . The role session that `AssumeRole` returns ends no later than `SessionExpiration` . The trust policy of the role must allow the `sts:AssumeRole` action for the calling service.

#### NOTE
The `IssueWorkloadIdentityContext` API is not available on the STS global endpoint or in every partition. Send requests to an STS endpoint in an Amazon Web Services Region where the API is available.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/IssueWorkloadIdentityContext)

## Synopsis

```
  issue-workload-identity-context
[--workload-identity-template-arn <value>]
--attestation-document <value>
[--target-role-arn <value>]
[--duration-seconds <value>]
[--session-duration-seconds <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]
```

## Options

`--workload-identity-template-arn` (string)

> The Amazon Resource Name (ARN) of the workload identity template that Amazon Web Services STS uses to build the identity of the workload from the attested values. The ARN of a template that an organization owns contains the organization ID in place of the account ID.

> If you don’t specify a template, the request fails with a validation error.

> Constraints:

> * min: `20`
> * max: `2048`
> * pattern: `arn:[^:]+:iam::(\d{12}|o-[a-z0-9]{10,32}):workload-identity-template/[\w+=,.@/-]+`

`--attestation-document` (string) [required]

> The facts that the calling service attests about the workload, as a JSON object. The keys and value types that the document can contain are set for each calling service. The document must be a single JSON object of up to 2,048 characters, with at least one key. Each value is a non-empty string of printable characters.

> Amazon Web Services STS records the attestation document in the CloudTrail event for the request, so don’t put secrets in it. If the document isn’t valid, the request fails with `InvalidAttestationDocumentException` .

> Constraints:

> * min: `1`
> * max: `2048`

`--target-role-arn` (string)

> The Amazon Resource Name (ARN) of the role that the calling service assumes with the context. The role must be in the account that owns the template. For a template that an organization owns, the role must be in the source account. If the role doesn’t exist or is in another account, the request fails with `AccessDenied` .

> If you don’t specify a role, the response contains only the `Subject` and the `ProviderArn` , with no context assertion to pass to `AssumeRole` .

> Constraints:

> * min: `20`
> * max: `2048`
> * pattern: `[\u0009\u000A\u000D\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]+`

`--duration-seconds` (integer)

> The time, in seconds, during which the calling service can pass the context to `AssumeRole` . The value can range from 60 seconds (1 minute) to 300 seconds (5 minutes). If you don’t specify a value, the value is 60 seconds.

> Constraints:

> * min: `60`
> * max: `300`

`--session-duration-seconds` (integer)

> The longest time, in seconds, that a role session from this context can last, counted from when Amazon Web Services STS issues the context. The value can range from 900 seconds (15 minutes) to 43,200 seconds (12 hours). The role session that `AssumeRole` returns ends at the earlier of this time and the session duration that the `AssumeRole` request sets.

> If you don’t specify a value, the context doesn’t limit the session duration.

> Constraints:

> * min: `900`
> * max: `43200`

`--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.

## Global Options

`--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.

* json
* text
* table
* yaml
* yaml-stream
* off

`--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.

* on
* off
* auto

`--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`.

* base64
* raw-in-base64-out

`--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.

* legacy
* json
* yaml
* text
* table
* enhanced

`--help` (boolean)

Display help for the command/subcommand.

## Output

ProvidedContext -> (structure)

> The context to pass to  AssumeRole in `ProvidedContexts` . `ProviderArn` is the ARN of the workload identity provider that issued the context. `ContextAssertion` is the signed and encrypted context. It is present only if the request specified `TargetRoleArn` .

> Pass the context as the only entry in `ProvidedContexts` . Treat the context assertion like a credential until it expires.

> ProviderArn -> (string)

> > The context provider ARN from which the trusted context assertion was generated.

> > Constraints:

> > * min: `20`
> > * max: `2048`
> > * pattern: `[\u0009\u000A\u000D\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]+`

> ContextAssertion -> (string)

> > The signed and encrypted trusted context assertion generated by the context provider. The trusted context assertion is signed and encrypted by Amazon Web Services STS.

> > Constraints:

> > * min: `4`
> > * max: `3072`

Subject -> (string)

> The identifier of the workload, up to 256 characters. For a workload identity provider that uses the SPIFFE naming scheme, this is the SPIFFE ID of the workload, for example `spiffe://example.org/payments/checkout` . A role session from this context carries this value as the identity of the workload.

Audience -> (string)

> The Amazon Web Services service principal that can pass the context to `AssumeRole` . This is the service principal of the caller. Present only if the request specified `TargetRoleArn` .

> Constraints:

> * min: `1`
> * max: `255`

Expiration -> (timestamp)

> The date and time, in UTC, after which `AssumeRole` no longer accepts the context. Present only if the request specified `TargetRoleArn` .

SessionExpiration -> (timestamp)

> The latest date and time, in UTC, at which a role session from this context can end. Present only if the request specified both `TargetRoleArn` and `SessionDurationSeconds` .
