

# Create a workload identity provider

**Preview release**  
Agent and workload identity is in preview release for AWS Identity and Access Management (IAM) and is subject to change.

Create a provider in a single account, or create one for your whole organization. IAM creates every provider that uses the Secure Production Identity Framework for Everyone (SPIFFE) scheme with two JSON Web Token (JWT) signing keys, so your workloads can receive JSON Web Token SPIFFE Verifiable Identity Documents (JWT-SVIDs) immediately. There's one key for ES384 and one for RS256, because services that verify tokens differ in which algorithm they accept. A workload chooses one when it requests a token. To issue X.509 SPIFFE Verifiable Identity Documents (X.509-SVIDs), attach a certificate authority after you create the provider, from its Outbound signer page. You can choose an existing AWS Private Certificate Authority (AWS Private CA). For an account-level provider, you can also create one there. For more information, see [Configure signing and the trust bundle](workload-identity-signing-trust-bundle.md).

## Create an account-level provider
<a name="wi-cp-account"></a>

### Console
<a name="wi-cp-account-console"></a>

1. Open the IAM console at [https://console.aws.amazon.com/iam/agent-workload-identity/](https://console.aws.amazon.com/iam/agent-workload-identity/).

1. In the navigation pane, choose **Agent and workload identity**, and then choose **Create provider**.

1. For **Name**, enter a name of 1 through 128 letters, digits, periods, underscores, and hyphens. The name is part of the provider ARN and can't be changed.

1. (Optional) For **Description**, enter up to 255 characters.

1. Under **Identity format and scope**, set these values:
   + **Scheme** – SPIFFE or None. For help choosing, see [Choose a scheme and trust domain](workload-identity-manage-providers.md#wi-mp-scheme-domain).
   + **Trust domain** – If you chose SPIFFE, keep the generated value or enter your own, such as `corp.example.com`. It doesn't need to be a DNS domain that you've registered.
   + **Scope** – This account.

1. Under **Templates**, choose **Use default templates**, **Customize templates**, or **Configure later**. These options are described in the organization-level steps.

1. Choose **Create provider and templates**. If you chose Configure later, choose **Create provider**.

### AWS CLI
<a name="wi-cp-account-cli"></a>

```bash
aws iam create-workload-identity-provider \
  --resource-scope ACCOUNT \
  --provider-name payments-prod \
  --scheme SPIFFE \
  --workload-identity-domain 111122223333.aws.internal
```

The response includes the provider ARN, its ID, and its JWT signers:

```json
{
  "Arn": "arn:aws:iam::111122223333:workload-identity-provider/payments-prod",
  "ProviderId": "AWPA3EXAMPLE7F3A91C2",
  "ResourceScope": "ACCOUNT",
  "Scheme": "SPIFFE",
  "WorkloadIdentityDomain": "111122223333.aws.internal",
  "OutboundSigners": {
    "X509": [],
    "Jwt": [ { "SigningAlgorithm": "ES384" }, { "SigningAlgorithm": "RS256" } ],
    "OidcIssuerUri": "https://wie-7f3a91c2e40b.workloads.tokens.sts.global.api.aws",
    "BundleEndpointUrl": "https://wie-7f3a91c2e40b.workloads.tokens.sts.global.api.aws/bundle"
  }
}
```

To create a provider with no domain, use --scheme NONE and omit --workload-identity-domain.

### AWS API
<a name="wi-cp-account-api"></a>

IAM API Reference: `CreateWorkloadIdentityProvider`

## Create an organization-level provider
<a name="wi-cp-org"></a>

An organization-level provider lets accounts across your organization share one trust domain and one set of signing keys. You create it from the management account or a delegated administrator account. Either way, IAM stores it in the management account. Member accounts then create templates under it, within the path prefixes that the provider's permissions allow. These permissions are the provider's resource policy.

### Prerequisites
<a name="wi-cp-org-prereqs"></a>
+ Your organization uses all features of AWS Organizations.
+ Trusted access between IAM and AWS Organizations is turned on.
+ Organization-level IAM resources are turned on. Only the management account can turn them on or off.

To turn on organization-level IAM resources in the console:

1. Sign in to the management account, and open the IAM console at [https://console.aws.amazon.com/iam/home\#/account\_settings?section=organization-level](https://console.aws.amazon.com/iam/home#/account_settings?section=organization-level).

1. Under **Organization level resource creation**, choose **Enable**.

If the setting is off when you create an organization-level provider from the management account, the console turns it on for you.

To turn on organization-level IAM resources with the AWS CLI, run this command from the management account:

```bash
aws iam enable-organization-level-resources
```

If trusted access for IAM isn't turned on, the call fails with ServiceAccessNotEnabled. If the organization doesn't use all features, it fails with OrganizationNotInAllFeaturesMode.

### Console
<a name="wi-cp-org-console"></a>

1. Sign in to the management account or a delegated administrator account, and open the IAM console at [https://console.aws.amazon.com/iam/agent-workload-identity/](https://console.aws.amazon.com/iam/agent-workload-identity/).

1. In the navigation pane, choose **Agent and workload identity**, and then choose **Create provider**.

1. Enter a **Name** and, optionally, a **Description**.

1. Under **Identity format and scope**, choose a **Scheme**, keep the generated **Trust domain** or enter your own, and for **Scope**, keep **Every account in this organization**.

1. Under **Member accounts**, keep **Allow member accounts to add their own templates, namespaced by account ID**. The console writes a default resource policy on the provider. Under it, each member account can create templates only under a path prefix that equals its own account ID.

1. Under **Templates**, choose how to configure identity templates for this provider:
   + **Use default templates** – Adds default templates for Amazon Elastic Kubernetes Service (Amazon EKS), AgentCore runtime, a capability of Amazon Bedrock AgentCore, and AgentCore Gateway, a capability of Amazon Bedrock AgentCore. Recommended for most setups.
   + **Customize templates** – Choose which templates to add by use case, and customize each one or keep its defaults.
   + **Configure later** – Add templates after the provider is created.

1. Choose **Create provider and templates**. If you chose Configure later, choose **Create provider**.

To issue X.509-SVIDs, attach a certificate authority from the provider's Outbound signer page after you create it. For an organization-level provider, use an existing certificate authority in an account other than the management account. For more information, see [Configure signing and the trust bundle](workload-identity-signing-trust-bundle.md).

### AWS CLI
<a name="wi-cp-org-cli"></a>

1. Create the provider:

   ```bash
   aws iam create-workload-identity-provider \
     --resource-scope ORGANIZATION \
     --provider-name corp-example-prod \
     --scheme SPIFFE \
     --workload-identity-domain corp.example.com
   ```

1. Assign path prefixes to member accounts. A new organization-level provider has no resource policy, so no member account can create templates under it until you add one. The following policy is the default that the console writes:

   ```bash
   aws iam put-workload-identity-provider-resource-policy \
     --workload-identity-provider-arn arn:aws:iam::o-a1b2c3d4e5:workload-identity-provider/corp-example-prod \
     --policy-document file://provider-policy.json
   ```

   `provider-policy.json`:

   ```json
   {
     "Version": "2012-10-17",
     "Statement": [{
       "Sid": "OrgMembersUnderOwnAccountPrefix",
       "Effect": "Allow",
       "Principal": "*",
       "Action": [
         "iam:AssociateWorkloadIdentityTemplate",
         "iam:DisassociateWorkloadIdentityTemplate"
       ],
       "Condition": {
         "StringEquals": { "aws:PrincipalOrgID": "o-a1b2c3d4e5" },
         "StringLike": {
           "iam:WorkloadIdentityPathPrefix": [
             "${aws:PrincipalAccount}",
             "${aws:PrincipalAccount}/*"
           ]
         }
       }
     }]
   }
   ```

### AWS API
<a name="wi-cp-org-api"></a>

IAM API Reference: `EnableOrganizationLevelResources`, `CreateWorkloadIdentityProvider`, `PutWorkloadIdentityProviderResourcePolicy`

## Assign custom path prefixes to member accounts
<a name="wi-cp-prefixes"></a>

Instead of, or in addition to, the default resource policy, you can assign each account or organizational unit (OU) its own prefix. Keep the prefixes that you assign distinct, so two accounts never try to claim the same names.

To edit the policy in the console, sign in to the management account or delegated administrator account, open the provider, and choose **Provider settings**. The member account permissions appear only for an organization-level provider. Edit the policy, and then choose **Save**.

The following statements let account 444455556666 create templates under data-team/ and account 111122226666 under ml-team/:

```json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Sid": "DataTeamAccountPathPrefix",
    "Effect": "Allow",
    "Principal": { "AWS": "arn:aws:iam::444455556666:root" },
    "Action": ["iam:AssociateWorkloadIdentityTemplate", "iam:DisassociateWorkloadIdentityTemplate"],
    "Condition": { "StringLike": { "iam:WorkloadIdentityPathPrefix": ["data-team", "data-team/*"] } }
  }, {
    "Sid": "MlTeamAccountPathPrefix",
    "Effect": "Allow",
    "Principal": { "AWS": "arn:aws:iam::111122226666:root" },
    "Action": ["iam:AssociateWorkloadIdentityTemplate", "iam:DisassociateWorkloadIdentityTemplate"],
    "Condition": { "StringLike": { "iam:WorkloadIdentityPathPrefix": ["ml-team", "ml-team/*"] } }
  }]
}
```

To assign a prefix to an OU, use `"Principal": "*"` with a ForAnyValue:StringLike condition on `aws:PrincipalOrgPaths`. To keep accounts in the OU apart, include the account in the prefix, for example `retail/${aws:PrincipalAccount}`.

Keep these points in mind:
+ A member account can't read the provider's resource policy. Tell each account team which path prefixes it can use.
+ IAM checks the policy only when a member account creates or deletes a template. Removing an account's Associate action stops new templates. Templates that the account already created keep working until it deletes them. Deleting a template that references an organization-level provider also requires iam:DisassociateWorkloadIdentityTemplate on the provider.
+ Inside a member account, you can narrow further with a service control policy (SCP) or identity-based policy on iam:WorkloadIdentityPathPrefix. For an example, see Control access with agent and workload identity.