Update limit policy

Update policy to limit resource usage by EC2 instance size

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

  2. Access the IAM service management console

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

CostGovernance

  1. Click the policy EC2_FamilyRestrict.

CostGovernance

  1. Click Edit policy.

CostGovernance

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

CostGovernance

  1. Click Save changes.

In this step we have clearly 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.