Prevent creating or expanding public connectivity for VPCs
Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.
Prevent creating or expanding public connectivity for VPCs is an AWS guardrail written in service control policies. Denies attaching or creating internet gateways, creating VPC peering connections and creating or updating AWS Global Accelerator resources unless the caller is the privileged role.
More network perimeter guardrails ยท About Service control policies
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"ec2:AttachInternetGateway",
"ec2:CreateInternetGateway",
"ec2:CreateEgressOnlyInternetGateway",
"ec2:CreateVpcPeeringConnection",
"ec2:AcceptVpcPeeringConnection",
"globalaccelerator:CreateAccelerator",
"globalaccelerator:CreateCrossAccountAttachment",
"globalaccelerator:CreateCustomRoutingAccelerator",
"globalaccelerator:CreateCustomRoutingEndpointGroup",
"globalaccelerator:CreateCustomRoutingListener",
"globalaccelerator:CreateEndpointGroup",
"globalaccelerator:CreateListener",
"globalaccelerator:UpdateAccelerator",
"globalaccelerator:UpdateAcceleratorAttributes",
"globalaccelerator:UpdateCrossAccountAttachment",
"globalaccelerator:UpdateCustomRoutingAccelerator",
"globalaccelerator:UpdateCustomRoutingAcceleratorAttributes",
"globalaccelerator:UpdateCustomRoutingListener",
"globalaccelerator:UpdateEndpointGroup",
"globalaccelerator:UpdateListener"
],
"Resource": "*",
"Condition": {
"ArnNotLike": {
"aws:PrincipalARN": "arn:aws:iam::${Account}:role/[PRIVILEGED_ROLE]"
}
}
}
]
}
- Blocks
- Denies attaching or creating internet gateways, creating VPC peering connections and creating or updating AWS Global Accelerator resources unless the caller is the privileged role.
- Breaks
- The README states it does not block existing direct internet access or access routed through an on-premises network, and VPC peering and Global Accelerator changes also need the privileged role. (source)
- Test before applying
- As for every Service control policies guardrail: how to test before enforcing
- Mechanism
- Service control policies (SCPs): IAM users, IAM roles and the root user in member accounts; not the management account and not service-linked roles.
- Taken from
- open source set, MIT-0 (README states MIT-0; LICENSE file fetched, MIT-0 text, Copyright Amazon.com, Inc.): https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/LICENSE
What the policy text names
It names 20 actions or patterns: ec2:AttachInternetGateway, ec2:CreateInternetGateway, ec2:CreateEgressOnlyInternetGateway, ec2:CreateVpcPeeringConnection, ec2:AcceptVpcPeeringConnection, globalaccelerator:CreateAccelerator, globalaccelerator:CreateCrossAccountAttachment, globalaccelerator:CreateCustomRoutingAccelerator, and more. Its conditions test aws:PrincipalARN.
What the source says
ec2:AttachInternetGateway (read 10 Nov 2026).
On what it breaks: "It doesn't block existing direct access or any access that routes through your on-premises network environment."
Related guardrails
- Network interfaces should disable IP forwardingAzure, Azure Policy (built-in definitions), network perimeter
- Gateway subnets should not have a network security groupAzure, Azure Policy (built-in definitions), network perimeter
- Configure key vaults to enable the firewallAzure, Azure Policy (built-in definitions), network perimeter
- Block internet gateway ingress for VPCs (declarative policy)AWS, Declarative policies, network perimeter
Related pages
Sources
- Prevent creating or expanding public connectivity for VPCs, read 10 Nov 2026
- What it breaks, read 10 Nov 2026
- How to test it first, read 10 Nov 2026
Last reviewed 16 Nov 2026.