# 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.

```json
{
  "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](https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Privileged-access-controls/README.md))
- **Test before applying:** As for every Service control policies guardrail: [how to test before enforcing](/mechanisms/scp/)
- **Mechanism:** [Service control policies (SCPs)](/mechanisms/scp/): 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](https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Privileged-access-controls/Prevent-creating-or-expanding-public-connectivity-for-VPCs.json), 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 forwarding](/guardrails/azure-policy-nic-no-ip-forwarding/): Azure, Azure Policy (built-in definitions), network perimeter
- [Gateway subnets should not have a network security group](/guardrails/azure-policy-gateway-subnet-no-nsg/): Azure, Azure Policy (built-in definitions), network perimeter
- [Configure key vaults to enable the firewall](/guardrails/azure-policy-keyvault-firewall/): Azure, Azure Policy (built-in definitions), network perimeter
- [Block internet gateway ingress for VPCs (declarative policy)](/guardrails/aws-declarative-vpc-block-public-access/): AWS, Declarative policies, network perimeter

## Related pages

- [Deny billing, tax and account contact changes (AWS Service control policies)](/guardrails/aws-scp-deny-billing-and-contact-changes/)
- [Deny enabling and disabling AWS Config (AWS Service control policies)](/guardrails/aws-scp-deny-config-changes/)
- [Deny modifications to specific CloudTrail trails (AWS Service control policies)](/guardrails/aws-scp-deny-cloudtrail-trail-changes/)

## Sources

- Prevent creating or expanding public connectivity for VPCs: https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Privileged-access-controls/Prevent-creating-or-expanding-public-connectivity-for-VPCs.json (read 10 Nov 2026)
- What it breaks: https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Privileged-access-controls/README.md (read 10 Nov 2026)
- How to test it first: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/aws-scp-prevent-vpc-public-connectivity/
