IAM policy example: limit EC2 actions to one Region, with a least privilege rewrite
Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.
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
Allow 834 actions (ec2:*) on every resource when aws:RequestedRegion StringEquals us-east-1.
Action or pattern Actions Access levels ec2:*834 List 225, Read 63, Write 521, Permissions management 23, Tagging 2
Checks
- High Allows 544 write or permissions-management actions (23 permissions management) on every resource ("Resource": "*"). AWS documentation for this check
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
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 pattern Actions Access levels ec2:RunInstances1 Write 1 ec2:StartInstances1 Write 1 ec2:StopInstances1 Write 1 ec2:DescribeInstances1 List 1 ec2:CreateTags1 Tagging 1
Checks
- Medium Allows 3 write or permissions-management actions on every resource ("Resource": "*"). AWS documentation for this check
Related pages
Sources
- IAM User Guide: EC2 access in a specific Region, read 16 Nov 2026
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026), read 16 Nov 2026
Last reviewed 16 Nov 2026.