Skip to content
IAM Policy Generator

IAM policy example: trust a service for one resource only, with a least privilege rewrite

Lets the EventBridge Scheduler service assume a role only for schedules in one schedule group and one account, using aws:SourceArn and aws:SourceAccount. The conditions prevent another customer's schedule from using the role. The original has no conditions. Resource names and account 111122223333 are placeholders used in AWS documentation.

Open the workbench ยท All examples

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

What it allows

  • Allows the Scheduler service to assume the role for any schedule.

What it allows

  1. Allow Service scheduler.amazonaws.com to sts:AssumeRole.

    Action or patternActionsAccess levels
    sts:AssumeRole1Write 1

Checks

  • Low Trusts scheduler.amazonaws.com with no aws:SourceArn or aws:SourceAccount condition, which AWS recommends against the confused deputy problem. AWS documentation for this check

Without a source condition, the confused deputy problem applies: a schedule created elsewhere that names this role could use it.

Least privilege rewrite

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "SchedulerGroup",
      "Effect": "Allow",
      "Principal": {
        "Service": "scheduler.amazonaws.com"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": {
          "aws:SourceAccount": "111122223333"
        },
        "ArnLike": {
          "aws:SourceArn": "arn:aws:scheduler:us-east-1:111122223333:schedule-group/orders"
        }
      }
    }
  ]
}

The rewrite requires the request to come from account 111122223333 and from the orders schedule group. Other schedules cannot use the role.

What it allows

  1. Allow Service scheduler.amazonaws.com to sts:AssumeRole when aws:SourceAccount StringEquals 111122223333 and aws:SourceArn ArnLike arn:aws:scheduler:us-east-1:111122223333:schedule-group/orders.

    Action or patternActionsAccess levels
    sts:AssumeRole1Write 1

Checks

No flags from the six checks.

Sources

  1. IAM User Guide: the confused deputy problem, read 16 Nov 2026
  2. IAM User Guide: create a role for an AWS service, read 16 Nov 2026
  3. AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026

Last reviewed 16 Nov 2026.