issueWorkloadIdentityContext

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.

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.

Samples

val resp = stsClient.issueWorkloadIdentityContext {
    workloadIdentityTemplateArn = "arn:aws:iam::444455556666:workload-identity-template/checkout"
    attestationDocument = "{\"ClusterName\":\"prod-cluster\",\"Namespace\":\"payments\",\"ServiceAccount\":\"checkout\"}"
    targetRoleArn = "arn:aws:iam::444455556666:role/checkout-role"
    durationSeconds = 60
    sessionDurationSeconds = 3600
}