---
title: "POST /v1/{+parent}/externalAccessRules"
method: POST
path: "/v1/{+parent}/externalAccessRules"
tags: ["projects"]
---

# POST /v1/{+parent}/externalAccessRules

`POST /v1/{+parent}/externalAccessRules`

Creates a new external access rule in a given network policy.

## Path parameters

- `parent` string, required

## Query parameters

- `externalAccessRuleId` string
- `requestId` string
- `validateOnly` boolean

## Request body

- ExternalAccessRule — External access firewall rules for filtering incoming traffic destined to `ExternalAddress` resources.
  - `updateTime` string, google-datetime — Output only. Last update time of this resource.
  - `description` string — User-provided description for this external access rule.
  - `state` 'STATE_UNSPECIFIED' | 'ACTIVE' | 'CREATING' | 'UPDATING' | 'DELETING' — Output only. The state of the resource.
  - `destinationIpRanges` IpRange[] — If destination ranges are specified, the external access rule applies only to the traffic that has a destination IP address in these ranges. The specified IP addresses must have reserved external IP addresses in the scope of the parent network policy. To match all external IP addresses in the scope of the parent network policy, specify `0.0.0.0/0`. To match a specific external IP address, specify it using the `IpRange.external_address` property.
    - `ipAddress` string — A single IP address. For example: `10.0.0.5`.
    - `ipAddressRange` string — An IP address range in the CIDR format. For example: `10.0.0.0/24`.
    - `externalAddress` string — The name of an `ExternalAddress` resource. The external address must have been reserved in the scope of this external access rule's parent network policy. Provide the external address name in the form of `projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}`. For example: `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address`.
  - `destinationPorts` string[] — A list of destination ports to which the external access rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. For example: `["22"]`, `["80","443"]`, or `["12345-12349"]`. To match all destination ports, specify `["0-65535"]`.
  - `priority` integer — External access rule priority, which determines the external access rule to use when multiple rules apply. If multiple rules have the same priority, their ordering is non-deterministic. If specific ordering is required, assign unique priorities to enforce such ordering. The external access rule priority is an integer from 100 to 4096, both inclusive. Lower integers indicate higher precedence. For example, a rule with priority `100` has higher precedence than a rule with priority `101`.
  - `sourcePorts` string[] — A list of source ports to which the external access rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. For example: `["22"]`, `["80","443"]`, or `["12345-12349"]`. To match all source ports, specify `["0-65535"]`.
  - `uid` string — Output only. System-generated unique identifier for the resource.
  - `action` 'ACTION_UNSPECIFIED' | 'ALLOW' | 'DENY' — The action that the external access rule performs.
  - `ipProtocol` string — The IP protocol to which the external access rule applies. This value can be one of the following three protocol strings (not case-sensitive): `tcp`, `udp`, or `icmp`.
  - `name` string — Output only. The resource name of this external access rule. Resource names are schemeless URIs that follow the conventions in https://cloud.google.com/apis/design/resource_names. For example: `projects/my-project/locations/us-central1/networkPolicies/my-policy/externalAccessRules/my-rule`
  - `createTime` string, google-datetime — Output only. Creation time of this resource.
  - `sourceIpRanges` IpRange[] — If source ranges are specified, the external access rule applies only to traffic that has a source IP address in these ranges. These ranges can either be expressed in the CIDR format or as an IP address. As only inbound rules are supported, `ExternalAddress` resources cannot be the source IP addresses of an external access rule. To match all source addresses, specify `0.0.0.0/0`.
    - `ipAddress` string — A single IP address. For example: `10.0.0.5`.
    - `ipAddressRange` string — An IP address range in the CIDR format. For example: `10.0.0.0/24`.
    - `externalAddress` string — The name of an `ExternalAddress` resource. The external address must have been reserved in the scope of this external access rule's parent network policy. Provide the external address name in the form of `projects/{project}/locations/{location}/privateClouds/{private_cloud}/externalAddresses/{external_address}`. For example: `projects/my-project/locations/us-central1-a/privateClouds/my-cloud/externalAddresses/my-address`.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/vmwareengine.md) · [All operations](https://skmtc.dev/google/apis/vmwareengine/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/vmwareengine/revisions/23816cc0f25a/schema)
