RealmDeployDocs
GuidesSingle sign-on for apps

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

  1. Open the IAM Identity Center console and choose Settings.
  2. On the Identity source tab, choose Actions → Change identity source.
  3. Select External identity provider and choose Next.
  4. Under Service provider metadata, copy these values to a text file:
Value in AWSUsed in Keycloak as
IAM Identity Center issuer URLThe Client ID of the SAML client
IAM Identity Center Assertion Consumer Service (ACS) URLValid 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.

SettingValue
Client typeSAML
Client IDThe IAM Identity Center issuer URL, exactly as copied
NameAWS IAM Identity Center
Valid redirect URIsEvery ACS URL from the console, one per line
IDP-Initiated SSO URL nameaws, 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:

SectionSettingValue
SAML capabilitiesName ID formatemail
SAML capabilitiesForce name ID formatOn
Signature and EncryptionSign documentsOn (the default)
Signature and EncryptionSign assertionsOn
Signature and EncryptionSignature algorithmRSA_SHA256

On the Keys tab:

SettingValue
Client signature requiredOff. Identity Center does not sign its requests.
Encrypt assertionsOff. 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/descriptor

You 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/descriptor

Check 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:

  1. Under Identity provider metadata, choose Choose file and upload keycloak-metadata.xml.
  2. Choose Next.
  3. 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 fieldValue
UsernameThe user's email in Keycloak, exactly
Email addressThe same email
First name, Last name, Display nameThe 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:

FieldValue
NameCostCenter tag
User AttributecostCenter, the user attribute in Keycloak
SAML Attribute Namehttps://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

  1. Open your AWS access portal URL, shown on the Settings page, in a private window. Identity Center sends you to Keycloak.
  2. 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.
  3. 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.
  4. To see what Keycloak sent, copy the SAMLResponse form 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

ErrorCauseFix
Keycloak shows Invalid requesterThe 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 uriThe 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-inNo 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 onlyThat 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 formatName 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 fileYou 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 failsThat 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

On this page