
ℹ️ Information: Amazon Elastic Block Store (Amazon EBS) provides highly available, durable block-level storage volumes for EC2 instances with 99.999% availability. These persistent storage volumes can be attached to any EC2 instance in the same Availability Zone.
AWS offers several EBS volume types optimized for different workload requirements:

💡 Pro Tip: For development environments, the newer gp3 volumes offer significant cost advantages over gp2 volumes. With gp3, you get 3,000 baseline IOPS at only $9.60/100GB, which is $2.40/100GB cheaper than gp2 volumes that provide only 300 baseline IOPS.

Create an IAM Policy to Restrict EBS Volume Types
IAM in the AWS Management Console search box
EC2_InstanceTypeRestrict, then select the policy


{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:*",
"Resource": "*"
},
{
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:148922931563:volume/*",
"Condition": {
"StringNotLike": {
"ec2:VolumeType": "gp3"
}
}
},
{
"Effect": "Deny",
"Action": "ec2:RunInstances",
"Resource": "arn:aws:ec2:*:148922931563:instance/*",
"Condition": {
"StringNotLike": {
"ec2:VolumeType": "gp3",
"ec2:InstanceType": [
"t3.small",
"t3.large"
]
}
}
}
]
}


ℹ️ Information: This policy allows users to create EC2 instances only with t3.small or t3.large instance types and only with gp3 EBS volumes, enforcing both cost efficiency and performance standards.
Verify Policy Enforcement: Allowed Configuration (t3.small with gp3)
EC2EC2_t3.small_gp3





Verify Policy Enforcement: Denied Configuration (t3.small with gp2)
EC2_t3.small_gp2




⚠️ Warning: The policy will similarly block attempts to launch instances with other volume types like io1 or io2, even though they offer higher performance, as they are significantly more expensive than gp3 volumes.
Additional Testing (Optional)
You can further verify the policy effectiveness by attempting to launch EC2 instances with:
🔒 Security Note: This IAM policy implementation demonstrates the principle of least privilege by allowing only the most cost-effective resources needed for development work, preventing accidental provisioning of more expensive resources.