Update restriction policy

Update policy to limit resource usage according to EC2 instance size

  1. Sign out and log in again with an IAM user with admin rights.

  2. Go to IAM service administration interface

    • Click Policies.
    • In the search box, enter EC2_FamilyRestrict.
    • Press the Enter key.

CostGovernance

  1. Click policy EC2_FamilyRestrict.

CostGovernance

  1. Click Edit policy.

CostGovernance

  1. Copy the policy below instead.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "ec2:*",
            "Resource": "*",
            "Condition": {
                "ForAllValues:StringLike": {
                    "ec2:InstanceType": [
                        "t3.nano"
                    ]
                }
            }
        }
    ]
}
  • Click Review policy.

CostGovernance

  1. Click Save changes.

In this step, we have specified that we can only create instances with family and size as t3.nano. In the next step, we will test the effectiveness of this policy.