All Tools View Categories About Contact Privacy

IAM Role Trust Relationship Generator

Build a role trust policy for any principal type — account, ARN, service, Federated SAML/OIDC, or anonymous "*" — with optional External ID / MFA conditions.

Runs entirely in your browser — nothing you type is uploaded. Generated JSON is a starting point: review it and replace any placeholder values before attaching it to a real role.
"*" trusts ANY AWS principal in ANY account. Almost never correct on its own — pair it with a hard-to-guess External ID or reconsider a specific principal.
-
action
-
resource field
0
conditions
-
structurally valid

  

About IAM Role Trust Relationship Generator

A trust policy decides who is allowed to assume an IAM role — it grants no AWS permissions on its own. IAM Role Trust Relationship Generator builds that statement for five principal shapes in one form: an AWS account (root), a specific IAM role or user ARN, an AWS service principal, a Federated SAML or OIDC identity provider, and — with a strong warning — the anonymous "*" principal that some genuinely public or heavily-conditioned trust relationships require.

Federated principals get real branching, not a cosmetic label: choosing SAML sets the action to sts:AssumeRoleWithSAML, choosing OIDC sets it to sts:AssumeRoleWithWebIdentity, and an optional audience value builds the <provider-host>:aud condition AWS recommends for Web Identity federation so a role trusting an OIDC provider is not left open to tokens issued for any audience. Every other principal type uses the standard sts:AssumeRole.

Two more optional conditions cover the hardening patterns that come up in almost every real cross-account or public-ish trust relationship: an External ID (sts:ExternalId) as the standard confused-deputy mitigation, and a Require MFA switch (aws:MultiFactorAuthPresent). All conditions this tool builds merge into one Condition block.

The "*" anonymous option exists because it is a real trust-policy shape — some setups (a role meant to be assumable cross-organization behind a strict External ID, for instance) legitimately use it — but it is also the single easiest way to accidentally expose a role to the entire internet, so it is never presented without an on-page warning, and pairing it with a hard-to-guess External ID is called out explicitly.

As with the rest of this tool suite, the shared statement builder defaults every statement to Resource: "*"; because trust policies use Principal in place of Resource, this generator explicitly strips that field so the copied JSON never carries a stray Resource key. Validation is structural only — Version, Statement, Effect, Action, and Principal presence — never a live AWS check, and every value you type stays in your browser.

Features

  • Five principal types — AWS account (root), specific role/user ARN, AWS service, Federated (SAML/OIDC), and anonymous "*" with a strong warning.
  • Real action branching for SAML vs OIDC federation.
  • Optional OIDC audience condition, derived from the provider ARN automatically.
  • Optional External ID and Require MFA conditions, mergeable together.
  • Resource field correctly omitted — the tool actively strips the shared builder's default.
  • Structural validation and a copyable/downloadable JSON document.
  • 100% client-side.

How to Use

  1. Pick a principal type.
  2. Fill in the value for that type.
  3. For Federated, choose SAML or OIDC and optionally set an audience.
  4. Optionally set External ID and/or Require MFA.
  5. Click Build trust policy.
  6. Copy or download the resulting JSON and review it before attaching it as the role's trust relationship.

Examples

Example 1 — EC2 instance role. Principal type AWS service, value ec2.amazonaws.com.

Example 2 — GitHub Actions OIDC. Principal type Federated/OIDC, provider ARN for token.actions.githubusercontent.com, audience sts.amazonaws.com — produces the recommended :aud condition automatically.

Example 3 — cross-account with External ID. Principal type AWS account, External ID set — the standard confused-deputy shape.

Example 4 — anonymous with warning. Principal type "*", paired with a hard-to-guess External ID — the tool flags this combination as high-risk on screen.

Benefits

  • Covers the full range of real trust-policy principal shapes in one tool, including federation.
  • OIDC audience condition built automatically from the provider ARN.
  • Honest about the risk of the "*" principal rather than hiding it.
  • Structural validation before you attach the policy.
  • Private — nothing you type leaves your browser.

Frequently Asked Questions

How is this different from the IAM Trust Policy Generator?
They cover the same underlying trust-policy shape but this tool adds two things the other does not: an explicit "*" (anonymous) principal option with a strong warning, and an OIDC audience condition (<code>&lt;provider-host&gt;:aud</code>) for Web Identity federation, in addition to the standard AWS account, specific ARN, AWS service, and SAML/OIDC federated principal types. Either tool builds a valid trust policy statement; use whichever fits your workflow.
Why does a trust policy have no "Resource" field?
A trust policy is attached to a role and controls who may call <code>sts:AssumeRole</code> (or a federated variant) against that role — the role itself is the implicit resource. AWS trust policies use <code>Principal</code> in place of <code>Resource</code>. The shared statement builder behind this tool always fills in <code>Resource: "*"</code> by default, so this generator explicitly deletes that field after building the statement — the output JSON never contains a Resource key.
What does the "*" (anonymous) principal mean, and when is it appropriate?
Setting Principal to <code>"*"</code> means literally any AWS principal in any account, including accounts you do not control, is trusted to attempt to assume this role, subject only to whatever Conditions you attach. This is almost never correct for a role trust policy and is a common source of accidental public exposure — it is included here because it is a real, valid trust-policy shape, and the tool would be dishonest pretending it does not exist, but it always ships with a strong on-page warning and should essentially always be paired with a hard-to-guess External ID condition or reconsidered entirely in favor of a specific account/role/OIDC principal.
What is the OIDC audience condition and why would I add it?
When trusting an OIDC identity provider (for example, GitHub Actions' OIDC provider), AWS recommends restricting which token audiences are accepted with a <code>StringEquals</code> condition on <code>&lt;provider-host&gt;:aud</code> (e.g. <code>token.actions.githubusercontent.com:aud</code>), commonly set to <code>sts.amazonaws.com</code>. Without it, any token issued by that provider for any audience could be presented to assume the role. This tool derives the condition key automatically from the provider ARN's host portion when you fill in an audience value.
What does the External ID condition do?
It adds <code>Condition.StringEquals["sts:ExternalId"]</code>, the standard AWS-documented mitigation for the confused-deputy problem in third-party cross-account access: the caller must present the exact agreed-upon external ID, or the assume-role call is denied even from the right account.
What does "Require MFA" do?
It adds <code>Condition.Bool["aws:MultiFactorAuthPresent"] = "true"</code>, so STS only allows the assume-role call if the calling principal authenticated with multi-factor authentication. It combines with External ID and the OIDC audience condition in the same Condition block.
Does this tool validate against AWS's live trust policy grammar?
No — it runs the same structural check used across these tools: <code>Version</code> present and recognized, a non-empty <code>Statement</code> array, each statement has a valid <code>Effect</code>, an <code>Action</code>, and (since trust policies have no Resource) a <code>Principal</code>. It never calls AWS and cannot confirm an account ID, ARN, or provider actually exists.
Is anything I type sent anywhere?
No — principal assembly, condition building, and validation all run locally in your browser.
Can I export the result?
Yes, Copy as JSON and Download .json appear once the trust policy is built. Review the generated JSON before attaching it to a real role, and replace any placeholder account IDs or ARNs with your real values.