Skip to content
IAM Policy Generator

IAM policy example: limit EC2 actions to one Region, with a least privilege rewrite

Allows EC2 actions in us-east-1 only, by comparing the aws:RequestedRegion condition key. Calls aimed at any other Region fail. The wildcard ec2:* expands to 834 actions, so the rewrite names the five compute actions a build team needs. The names and the account ID 111122223333 are AWS documentation placeholders.

Open the workbench ยท All examples

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "OneRegion",
      "Effect": "Allow",
      "Action": "ec2:*",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:RequestedRegion": "us-east-1"
        }
      }
    }
  ]
}

What it allows

  • Allows every EC2 action on every resource when the request targets us-east-1.

What it allows

  1. Allow 834 actions (ec2:*) on every resource when aws:RequestedRegion StringEquals us-east-1.

    Action or patternActionsAccess levels
    ec2:*834List 225, Read 63, Write 521, Permissions management 23, Tagging 2

Checks

The Region limit works, yet the action list includes 834 actions across networking, images and volumes.

Least privilege rewrite

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "InstancesInRegion",
      "Effect": "Allow",
      "Action": [
        "ec2:RunInstances",
        "ec2:StartInstances",
        "ec2:StopInstances",
        "ec2:DescribeInstances",
        "ec2:CreateTags"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:RequestedRegion": "us-east-1"
        }
      }
    }
  ]
}

The rewrite keeps the Region condition and lists five actions for launching and managing instances. Image, network and volume administration are removed.

What it allows

  1. Allow 5 actions (ec2:RunInstances, ec2:StartInstances, ec2:StopInstances, ec2:DescribeInstances, ec2:CreateTags) on every resource when aws:RequestedRegion StringEquals us-east-1.

    Action or patternActionsAccess levels
    ec2:RunInstances1Write 1
    ec2:StartInstances1Write 1
    ec2:StopInstances1Write 1
    ec2:DescribeInstances1List 1
    ec2:CreateTags1Tagging 1

Checks

Sources

  1. IAM User Guide: EC2 access in a specific Region, read 16 Nov 2026
  2. AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026

Last reviewed 16 Nov 2026.