Create limit policy

Create policy to limit resource usage by EBS volume type

  1. Sign out and log back in with an IAM user with admin privileges.

  2. Access the IAM service management console

    • Click Policies.
    • Click Create Policy.

CostGovernance

  1. On the Create policy page.
    • Click the JSON tab.
    • Copy the policy snippet below into it.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Deny",
            "Action": "ec2:*",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "ec2:VolumeType": "io1"
                }
            }
        }
    ]
}

Click Next.

CostGovernance

  1. At Name enter EC2EBS_Restrict.
    • At Description enter Dont allow EBS io1 volumes.
    • Click Create policy.

CostGovernance

In the next step, we will attach the policy to the CostTest group and then test the effectiveness of this policy.