ℹ️ Information: AWS Identity and Access Management (IAM) allows you to implement fine-grained access controls that restrict service usage to specific AWS Regions, helping organizations control costs by limiting where resources can be deployed.
For example, if your end users are primarily located in Vietnam, deploying resources in the Singapore Region (ap-southeast-1) provides lower latency and reduced data transfer costs compared to more distant AWS Regions.
⚠️ Warning: This lab requires at least two IAM Users to demonstrate the implementation and testing of region-based restrictions. If you haven’t created IAM Users previously, refer to the lab: Access Rights Management with AWS IAM.
Create a Region Restriction Policy
IAM
in the AWS Management Console search box{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "ec2:*",
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:RequestedRegion": "ap-southeast-1"
}
}
}
]
}
RegionRestrict
EC2 access in ap-southeast-1 only
💡 Pro Tip: This policy grants full EC2 permissions (ec2:*
) but only when the requested region is Singapore (ap-southeast-1
). Any EC2 actions attempted in other regions will be denied.
Create an IAM Group for Cost Management
CostTest
RegionRestrict
ℹ️ Information: Notice that your policy appears as Customer managed in the Type column, indicating it was created by you and can be edited. AWS managed policies (created and maintained by AWS) cannot be modified.
Create a Test User
TestUser
🔒 Security Note: As a cloud administrator, following these steps ensures you don’t know the password for IAM users you create. This enforces the principle of least privilege by requiring users to set their own passwords and take responsibility for their AWS account interactions.
💡 Pro Tip: Adding users to groups follows AWS best practices for centralized permission management. This approach simplifies administration by allowing you to add or remove permissions for multiple users simultaneously, reducing the risk of permission inconsistencies.
Test EC2 Access in the Singapore Region
EC2singapore
as the instance nameℹ️ Information: In a production environment, you would create or select an existing key pair to enable secure SSH access to your instance. For this test, we’re only verifying policy effectiveness, so a key pair isn’t necessary.
Verify EC2 Access Denial in the Tokyo Region
EC2tokyo
⚠️ Warning: Notice that the interface cannot display AMI ID, instance type, VPC, or subnet information because the policy restricts all EC2 actions in regions other than Singapore.
Verify S3 Access Denial in the Singapore Region
💡 Pro Tip: This demonstrates how IAM policies can be used to implement precise service-level and region-level access controls. Users can only access the specific services and regions explicitly allowed by their assigned policies.
Congratulations! You’ve successfully implemented and tested a region-based access control policy that restricts EC2 usage to the Singapore region only. This approach demonstrates how AWS IAM can be used as an effective cost governance tool by preventing resource deployment in unauthorized regions.