AWS Learning Journey

Beyond AdministratorAccess: Advanced IAM That Real Teams Use

Trust policies, cross-account roles, permissions boundaries, and attribute-based access control — the IAM patterns that let teams move fast without handing out admin.

10 min read · 1897 words
AWSAWS IAMCloud SecurityDevOpsPlatform Engineering
Beyond AdministratorAccess: Advanced IAM That Real Teams Use cover image

AWS from Zero to Production — Phase 2, Part 2 of 6 · See the full series roadmap


In a small team, everyone has AdministratorAccess. It’s simple, and nothing breaks.

Then the team grows. Developers need to create roles for their Lambda functions — but if they can create any role, they can create one with admin rights and give it to themselves. The data team needs read access to production logs from another account. An auditor needs to see everything but change nothing. A contractor needs access for two weeks.

“Give everyone admin” stops working. “Make every developer file a ticket” doesn’t work either.

Advanced IAM is how real teams solve this: delegating safely, crossing account boundaries cleanly, and scaling permissions with tags instead of endless policies.

What you’ll walk away with


Every role has two policies

A role is defined by two different policies that answer two different questions:

Both must line up. If the trust policy doesn’t allow you, you can’t assume the role. If the permissions policy doesn’t allow an action, the role can’t perform it.

A trust policy for an AWS service

This role can be assumed by Lambda functions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "Service": "lambda.amazonaws.com" },
      "Action": "sts:AssumeRole"
    }
  ]
}

A trust policy for another account

This role, in account 111122223333, can be assumed by a specific role in account 444455556666:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "AWS": "arn:aws:iam::444455556666:role/analytics-role" },
      "Action": "sts:AssumeRole"
    }
  ]
}

Engineer’s note: Trust a specific role ARN rather than a whole account (arn:aws:iam::444455556666:root) whenever you can. Trusting the account root delegates the decision to every administrator in that account.


Cross-account access

Cross-account access is how a multi-account organization actually works day to day.

How it works

Account B (analytics)                  Account A (production)
---------------------                  ----------------------
analytics-role                          prod-log-reader role
  identity policy allows:                 trust policy allows:
  sts:AssumeRole on                       analytics-role from Account B
  prod-log-reader            ------>      permissions policy allows:
                                          read production logs

Two sides must agree:

  1. Account A (the resource owner) creates a role whose trust policy names the principal in Account B.
  2. Account B (the caller) grants its principal permission to call sts:AssumeRole on that role’s ARN.

The caller then assumes the role and receives temporary credentials that act inside Account A.

Third parties and the confused deputy problem

When a third-party vendor assumes a role in your account, add an external ID condition:

{
  "Condition": {
    "StringEquals": { "sts:ExternalId": "a-unique-value-from-the-vendor" }
  }
}

The external ID prevents the “confused deputy” problem: another customer of the same vendor can’t trick the vendor into accessing your account, because they don’t know your external ID.


Permissions boundaries

A permissions boundary sets the maximum permissions an IAM user or role can have. It doesn’t grant anything on its own.

Effective permissions = identity policy ∩ permissions boundary.

The problem it solves

You want developers to create IAM roles for their own Lambda functions — without waiting for the platform team. But iam:CreateRole plus iam:AttachRolePolicy normally means a developer could create an admin role.

The pattern

  1. Create a boundary policy, such as DeveloperBoundary, that allows only the services your developers should use — for example, S3, DynamoDB, Lambda, and CloudWatch Logs — and nothing in IAM.
  2. Let developers create roles only if they attach that boundary:
{
  "Sid": "CreateRolesOnlyWithBoundary",
  "Effect": "Allow",
  "Action": [
    "iam:CreateRole",
    "iam:AttachRolePolicy",
    "iam:PutRolePolicy"
  ],
  "Resource": "arn:aws:iam::111122223333:role/app-*",
  "Condition": {
    "StringEquals": {
      "iam:PermissionsBoundary": "arn:aws:iam::111122223333:policy/DeveloperBoundary"
    }
  }
}
  1. Also deny developers the ability to change or remove boundaries (iam:DeleteRolePermissionsBoundary, iam:PutRolePermissionsBoundary, and edits to the boundary policy itself).

Now any role a developer creates can never exceed DeveloperBoundary — even if they attach AdministratorAccess to it.

SCP vs. boundary: An SCP limits every identity in an account. A permissions boundary limits one user or role. Use SCPs for organization-wide guardrails and boundaries for safe delegation inside an account.


Session policies

A session policy is passed when assuming a role, and it further limits that one session:

aws sts assume-role \
  --role-arn arn:aws:iam::111122223333:role/data-engineer \
  --role-session-name quick-read \
  --policy '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:GetObject","Resource":"arn:aws:s3:::raw-data/*"}]}'

The session gets the intersection of the role’s permissions and the session policy. It’s useful when a tool or a pipeline step should use only a slice of a broader role.


Conditions: the context of a request

Conditions turn “allow this action” into “allow this action only when…”.

Condition operators you’ll use most

Global condition keys worth knowing

Example: require MFA for destructive actions

{
  "Sid": "DenyDeleteWithoutMFA",
  "Effect": "Deny",
  "Action": [
    "s3:DeleteBucket",
    "ec2:TerminateInstances"
  ],
  "Resource": "*",
  "Condition": {
    "BoolIfExists": { "aws:MultiFactorAuthPresent": "false" }
  }
}

Watch out: The ...IfExists variant matters. Without it, requests that don’t include the MFA key at all — such as those made with long-term access keys — would slip past the condition.


Attribute-based access control (ABAC)

Traditional, role-based access control (RBAC) writes a policy per team and resource. As teams and projects grow, so does the number of policies.

Attribute-based access control (ABAC) uses tags instead: allow access when the principal’s tag matches the resource’s tag.

Example: teams manage only their own instances

{
  "Sid": "ManageOwnProjectInstances",
  "Effect": "Allow",
  "Action": [
    "ec2:StartInstances",
    "ec2:StopInstances",
    "ec2:RebootInstances"
  ],
  "Resource": "arn:aws:ec2:*:*:instance/*",
  "Condition": {
    "StringEquals": {
      "aws:ResourceTag/project": "${aws:PrincipalTag/project}"
    }
  }
}

A user tagged project=payments can manage instances tagged project=payments — and no others. When a new project starts, you add tags, not policies.

Engineer’s note: ABAC only works if tags are trustworthy. Control who can change tags with aws:RequestTag and aws:TagKeys conditions, and standardize tag keys with tag policies from Phase 1.


Role chaining

Role chaining is assuming a role while already using a role’s temporary credentials — for example, a CI role assuming a deployment role in another account.


Service-linked roles

A service-linked role is a special role that an AWS service creates and manages in your account, such as AWSServiceRoleForElasticLoadBalancing.

You’ll see them appear automatically as you use services. That’s normal.


Tools that keep permissions tight

IAM Access Analyzer

IAM Access Analyzer helps you find and fix overly broad access:

Engineer’s note: Policy generation is the easiest path to least privilege. Run a workload with a broad role in a test account, generate a policy from its real activity, then replace the broad role.

IAM credential reports

A credential report is a CSV listing every IAM user and the state of their credentials: password last used, MFA enabled, access key age and last use.

aws iam generate-credential-report
aws iam get-credential-report \
  --query Content \
  --output text | base64 --decode > credential-report.csv

Use it to find old access keys, users without MFA, and accounts nobody has signed in to for months.


IAM Identity Center and permission sets

You set up IAM Identity Center in Phase 1. Here’s what was happening behind the scenes:

That’s why your CLI identity in Phase 1 was an assumed-role ARN. Identity Center is IAM roles, managed centrally.

Engineer’s note: Design permission sets around job functions, not individuals: PlatformAdmin, Developer, DataEngineer, ReadOnlyAuditor. Assign them to groups, and give production accounts narrower permission sets than development accounts.


The full picture

Putting Parts 1 and 2 together, a request can be shaped by:

An explicit deny in any of them wins. An allow is needed from the identity or resource policy, and every limiting layer must permit the action.


Common mistakes


Key takeaways


Quick self-check

Test yourself before moving on:

  1. A role’s permissions policy allows s3:*, but its trust policy doesn’t list you. Can you use the role?
  2. An identity policy allows iam:*, and its permissions boundary allows only s3:*. Can it create an IAM role?
  3. Why should a third-party vendor’s role include an external ID condition?
  4. What’s the maximum session duration when you chain roles?

Answers

  1. No. If the trust policy doesn’t allow you to assume the role, its permissions don’t matter.
  2. No. Effective permissions are the intersection of the identity policy and the boundary — here, only S3.
  3. To prevent the confused deputy problem: another customer can’t trick the vendor into accessing your account.
  4. One hour.

What’s next

In Part 3, we stop using long-term keys entirely: SAML, OpenID Connect, and how GitHub Actions can get AWS credentials without storing a single secret.

Do you use permissions boundaries or ABAC in your team? What worked — and what didn’t? Tell me in the comments.


Share this article

LinkedIn post draft