

# Define agent and workload identities

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

After you create a provider, you decide how your workloads are named. You do this with a workload identity template.

A workload identity template is a rule that builds a name for each workload from attested facts, for example `spiffe://corp.example.com/retail/eks/prod-cluster-1/ns/payments/sa/checkout`. IAM stores the template, not a record for each workload. A template names a whole group of workloads, such as every pod in a cluster or every agent in a runtime. You name agents and workloads with templates. Under an organization-level provider, member accounts can create templates under the path prefixes assigned to them.

Each template carries an attestation policy that decides which workloads can receive the identity. A template with no attestation policy issues nothing.

**Topics**
+ [How an identifier is built](#wi-def-how-built)
+ [Identifier naming rules](#wi-def-naming-rules)
+ [Create workload identity templates](workload-identity-templates.md)
+ [Write attestation policies](workload-identity-attestation-policies.md)

## How an identifier is built
<a name="wi-def-how-built"></a>

An identifier has up to three parts, joined with slashes:

```
spiffe://corp.example.com / retail-payments / eks/prod-cluster-1/ns/payments/sa/checkout
└── naming root (provider) ┘ └ path prefix ┘   └ path pattern (template) ┘
```
+ The naming root comes from the provider: `spiffe://` plus the domain under the Secure Production Identity Framework for Everyone (SPIFFE) scheme, or nothing under NONE.
+ The path prefix is the part of the name space that you, or your organization's identity administrator, own.
+ The rest is rendered from the template's path pattern using attested facts.

Nobody types the naming root, and a workload's attested facts can't change the path prefix.

## Identifier naming rules
<a name="wi-def-naming-rules"></a>

**Segments.** A segment is the text between two slashes. Every segment, whether you type it or it comes from an attested fact, can contain only:
+ Letters A through Z and a through z
+ Digits 0 through 9
+ Periods (.), hyphens (-), and underscores (\_)

A segment can't be empty, and can't be exactly . or ..

**Lengths.**


| Part | Rule | 
| --- | --- | 
| Path prefix | One or more segments, up to 64 characters. No leading or trailing slash. | 
| Full identifier | Up to 256 characters, including the naming root. A longer identifier fails at issuance with InvalidWorkloadIdentityConfiguration (reason identifierTooLarge). | 
| Resource name (in the ARN) | 1 through 128 letters, digits, underscores, and hyphens. Provider names can also contain periods (.). | 

**Comparison.** Identifiers are compared exactly and are case-sensitive everywhere, including in policies and AWS CloudTrail. Prod and prod are different workloads. Condition key names, such as `aws:WorkloadAttestation/aws/eks/ClusterName`, are case-insensitive, like all IAM condition keys.

**Reuse after delete.** Identifiers aren't reserved. A workload that presents the same attested facts receives the same identifier, and so the same access, even after the original workload or template is deleted and re-created. A deleted template's resource name can be reused.

**Always pair the identifier with its provider.** An identifier is unique only within its provider. Two providers can issue the same string. When you write a policy, match both the identifier (`aws:OriginIdentity/Subject`) and the provider ARN (`aws:OriginIdentity/Issuer`).

A template's name and path are fixed. After you create a template, you can't change its name, path prefix, or path pattern, because every identifier it builds and every policy that names one depends on them. To change one, create a new template. You can replace the template's attestation policy and change its tags at any time.