Keycloak SSO for AWS IAM Identity Center
Use Keycloak as the external SAML 2.0 identity provider of AWS IAM Identity Center, with an email NameID, and create the matching users in Identity Center.
IAM Identity Center can hand sign-in to an external SAML 2.0 identity provider. With Keycloak as that provider, users sign in to the AWS access portal, and from there to AWS accounts, with their Keycloak account. Identity Center still keeps its own users and groups: Keycloak proves who the user is, and Identity Center decides what they can open.
Checked against the AWS IAM Identity Center User Guide and Keycloak 26.8 on 25 November 2026.
Replace auth.example.com with your RealmDeploy hostname and acme with your realm.
Every user must already exist in IAM Identity Center before they can sign in. Keycloak cannot create them there: it does not send users to other apps over SCIM, and tenants cannot run extensions. Create users and groups in Identity Center yourself, in its console or with its Identity Store API or the AWS CLI. See Create the users in Identity Center.
How sign-in matches users
AWS sets these rules for an external identity provider:
- The SAML NameID format must be email address,
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress, and the value must be an email address. - The NameID must exactly match the Username of a user in Identity Center. If it does not, sign-in fails even though Keycloak signed the user in.
- Identity Center does not sign its SAML requests and does not support encrypted assertions.
So in Keycloak you send the user's email as the NameID, and in Identity Center each user's Username is that same email.
In AWS: copy the service provider values
- Open the IAM Identity Center console and choose Settings.
- On the Identity source tab, choose Actions → Change identity source.
- Select External identity provider and choose Next.
- Under Service provider metadata, copy these values to a text file:
| Value in AWS | Used in Keycloak as |
|---|---|
| IAM Identity Center issuer URL | The Client ID of the SAML client |
| IAM Identity Center Assertion Consumer Service (ACS) URL | Valid redirect URIs and Assertion Consumer Service POST Binding URL |
The console lists an IPv4-only and a dual-stack ACS URL, and one more pair for each additional Region if you replicated Identity Center. Copy all of them. An ACS URL looks like https://us-west-2.signin.aws/platform/saml/acs/<tenant-id>.
Leave this page open. You come back to it to upload Keycloak's metadata.
In Keycloak
Create the SAML client
Open Clients, choose Create client, and use these values. The first three are on the General settings step, the rest on Login settings.
| Setting | Value |
|---|---|
| Client type | SAML |
| Client ID | The IAM Identity Center issuer URL, exactly as copied |
| Name | AWS IAM Identity Center |
| Valid redirect URIs | Every ACS URL from the console, one per line |
| IDP-Initiated SSO URL name | aws, only if users should also start sign-in from Keycloak |
Choose Save. Keycloak matches the issuer in each SAML request to a client by its Client ID, so a single changed character breaks sign-in.
Set the NameID and signatures
On the client's Settings tab:
| Section | Setting | Value |
|---|---|---|
| SAML capabilities | Name ID format | email |
| SAML capabilities | Force name ID format | On |
| Signature and Encryption | Sign documents | On (the default) |
| Signature and Encryption | Sign assertions | On |
| Signature and Encryption | Signature algorithm | RSA_SHA256 |
On the Keys tab:
| Setting | Value |
|---|---|
| Client signature required | Off. Identity Center does not sign its requests. |
| Encrypt assertions | Off. Identity Center does not support it. |
On the Advanced tab, under Fine Grain SAML Endpoint Configuration, set Assertion Consumer Service POST Binding URL to the ACS URL of your primary Region. Keycloak uses it when sign-in starts from Keycloak. When sign-in starts from AWS, Keycloak takes the ACS URL from the request and checks it against Valid redirect URIs.
Choose Save on each tab.
Identity Center needs no SAML attributes for sign-in. The https://aws.amazon.com/SAML/Attributes/Role and RoleSessionName attributes belong to IAM SAML federation, where an identity provider signs users straight in to IAM roles. That is a different setup; do not add them here.
Download the IdP metadata
Keycloak publishes the realm's SAML metadata, with its signing certificate, at:
https://auth.example.com/realms/acme/protocol/saml/descriptorYou can also open it from Realm settings → General → SAML 2.0 Identity Provider Metadata. Save it as a file:
curl -o keycloak-metadata.xml https://auth.example.com/realms/acme/protocol/saml/descriptorCheck it with the SAML metadata viewer if you like. It holds the entity ID https://auth.example.com/realms/acme, the certificate and the SingleSignOnService URL, which is what AWS asks for.
In AWS: change the identity source
Back on the Configure external identity provider page:
- Under Identity provider metadata, choose Choose file and upload
keycloak-metadata.xml. - Choose Next.
- Read the notice, type ACCEPT, and choose Change identity source.
Changing between the Identity Center directory and an external identity provider keeps your users, groups and assignments. Users who are signed in keep their session until it reaches the session duration; new sign-ins go to Keycloak.
To change the Keycloak values later, open Settings → Identity source → Actions → Manage authentication and choose Edit IdP metadata.
Create the users in Identity Center
Identity Center calls this manual provisioning. Each user needs a unique Username and a unique Email address, and the Username must be identical to the NameID Keycloak sends, which is the user's email in Keycloak.
| Identity Center field | Value |
|---|---|
| Username | The user's email in Keycloak, exactly |
| Email address | The same email |
| First name, Last name, Display name | The user's name |
In the console: Users → Add user, fill in the fields above, add the user to groups if you want, and choose Add user.
With the AWS CLI:
aws identitystore create-user \
--identity-store-id d-1234567890 \
--user-name [email protected] \
--name "GivenName=Jane,FamilyName=Doe" \
--display-name "Jane Doe" \
--emails "Type=work,[email protected],Primary=true"Your identity store ID (d- followed by ten characters) is on the Settings page. Groups and memberships work the same way: Groups → Create group in the console, or aws identitystore create-group and aws identitystore create-group-membership.
When you remove a user from Keycloak, also disable or delete them in Identity Center. Nothing keeps the two in sync.
Groups and roles
With manual provisioning, groups live only in Identity Center, and they do not need to match your Keycloak groups. Identity Center does not read groups from the SAML assertion, so Keycloak group and role mappers have no effect here.
Grant access in Identity Center: under Multi-account permissions → AWS accounts, select accounts, choose Assign users or groups, and pick a permission set.
Attributes for access control (optional). If you use attribute-based access control, Identity Center can take attributes from the SAML assertion and pass them to AWS accounts as session tags. Turn it on under Settings → Attributes for access control. Then add one mapper per tag on the client's Client scopes tab, in <client-id>-dedicated, with Configure a new mapper → User Attribute:
| Field | Value |
|---|---|
| Name | CostCenter tag |
| User Attribute | costCenter, the user attribute in Keycloak |
| SAML Attribute Name | https://aws.amazon.com/SAML/Attributes/AccessControl:CostCenter |
The part after AccessControl: is the tag key. If the same attribute is also set up in Identity Center, Identity Center sends its own stored value instead.
Test it
- Open your AWS access portal URL, shown on the Settings page, in a private window. Identity Center sends you to Keycloak.
- Sign in as a test user whose email matches an Identity Center Username. You land on the access portal and see the accounts assigned to that user.
- If you set IDP-Initiated SSO URL name, also try sign-in from Keycloak at
https://auth.example.com/realms/acme/protocol/saml/clients/aws. - To see what Keycloak sent, copy the
SAMLResponseform field from your browser's network tab and paste it into the SAML response decoder. Check the NameID format and value.
AWS records failed sign-ins in CloudTrail under the event name ExternalIdPDirectoryLogin.
Common errors
| Error | Cause | Fix |
|---|---|---|
| Keycloak shows Invalid requester | The Client ID differs from the issuer URL in the request, or Client signature required is on. | Paste the IAM Identity Center issuer URL into Client ID again and turn Client signature required off. |
| Keycloak shows Invalid redirect uri | The ACS URL in the request is not in Valid redirect URIs, often the dual-stack URL or one for another Region. | Add every ACS URL from the console. |
| Keycloak signs the user in, then AWS refuses the sign-in | No Identity Center user has a Username equal to the NameID. | Create the user with the Keycloak email as Username, exactly. Check the NameID with the SAML response decoder. |
| Sign-in fails for one user only | That user has no email in Keycloak, or a different one than in Identity Center. | Set the email in Keycloak and match it in Identity Center. |
| NameID has the wrong format | Name ID format is not email, or Force name ID format is off. | Set both. The NameID format reference lists the URNs. |
| AWS rejects the metadata file | You uploaded the wrong file. AWS needs an entity ID, a certificate and a SingleSignOnService location, in under 75,000 characters. | Upload the realm descriptor from /protocol/saml/descriptor, not the AWS metadata. |
| Sign-in through an additional Region fails | That Region's ACS URL is missing in Keycloak. | Add the Region's ACS URLs to Valid redirect URIs. |
FAQ
Can Keycloak create the users in Identity Center for me?
No. Identity Center's automatic provisioning needs the identity provider to push users over SCIM, and Keycloak does not do that. A SCIM extension would have to run inside Keycloak, and tenants cannot run extensions. Create users in the Identity Center console, or script it with the Identity Store API or the AWS CLI from your own systems.
Can I use a persistent or username NameID?
No. AWS requires the email address NameID format, and the value must look like an email address.
Does Keycloak need an outgoing connection to AWS?
No. Every step runs through the user's browser: AWS redirects to Keycloak, and Keycloak posts the signed response back to AWS. You do not need to ask us to open anything.
What happens when Keycloak's signing key changes?
The certificate AWS trusts comes from the metadata you uploaded. After a key change in Realm settings → Keys, download the descriptor again and update the IdP metadata in Identity Center before you disable the old key.
Sources
- AWS, How to connect to an external identity provider: https://docs.aws.amazon.com/singlesignon/latest/userguide/how-to-connect-idp.html
- AWS, Using SAML and SCIM identity federation with external identity providers: https://docs.aws.amazon.com/singlesignon/latest/userguide/other-idps.html
- AWS, Provision users and groups from an external identity provider (manual provisioning): https://docs.aws.amazon.com/singlesignon/latest/userguide/provision-automatically.html
- AWS, Considerations for changing your identity source: https://docs.aws.amazon.com/singlesignon/latest/userguide/manage-your-identity-source-considerations.html
- AWS, How to change an external identity provider's metadata: https://docs.aws.amazon.com/singlesignon/latest/userguide/how-to-change-idp-metadata.html
- AWS, ACS endpoints in the primary and additional Regions: https://docs.aws.amazon.com/singlesignon/latest/userguide/multi-region-workforce-access.html
- AWS, Add users to your Identity Center directory: https://docs.aws.amazon.com/singlesignon/latest/userguide/addusers.html
- AWS CLI, identitystore create-user: https://docs.aws.amazon.com/cli/latest/reference/identitystore/create-user.html
- AWS, Attributes for access control: https://docs.aws.amazon.com/singlesignon/latest/userguide/configure-abac.html
- AWS, Configure SAML and SCIM with Okta (passing attributes for access control): https://docs.aws.amazon.com/singlesignon/latest/userguide/gs-okta.html
- Keycloak Server Administration Guide, creating a SAML client, IDP initiated login and the SAML descriptor: https://www.keycloak.org/docs/latest/server_admin/
Keycloak SSO for Kubernetes
Let kubectl users sign in to a Kubernetes cluster with Keycloak, map Keycloak groups to RBAC, and see what EKS and AKS let you configure.
Keycloak SSO for Jenkins
Sign in to Jenkins with Keycloak through the OpenId Connect Authentication plugin, map groups to Matrix or Role-based permissions, and use JCasC.