An IAM policy that prevents users from terminating EC2 instances when the request does not come from a specified IP range. This policy provides the permissions necessary to complete this action using the AWS API or AWS CLI only.

 
Tags
Console Access
API and CLI Access
Missing Parameters
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "ec2:TerminateInstances"
            ],
            "Resource": [
                "*"
            ],
            "Effect": "Allow",
            "Condition": []
        },
        {
            "Action": [
                "ec2:TerminateInstances"
            ],
            "Resource": "*",
            "Effect": "Deny",
            "Condition": [
                {
                    "NotIpAddress": {
                        "aws:SourceIp": [
                            ""
                        ]
                    }
                }
            ]
        }
    ]
}
Customize Policy
* Required field