NAME

gcloud compute addresses create - reserve IP addresses

SYNOPSIS

gcloud compute addresses create [NAME ...] [--description=DESCRIPTION] [--endpoint-type=ENDPOINT_TYPE] [--network=NETWORK] [--network-tier=NETWORK_TIER] [--prefix-length=PREFIX_LENGTH] [--purpose=PURPOSE] [--subnet=SUBNET] [--addresses=ADDRESS,[ADDRESS,...] | --ip-version=IP_VERSION] [--global | --region=REGION] [GCLOUD_WIDE_FLAG ...]

DESCRIPTION

gcloud compute addresses create is used to reserve one or more IP addresses. Once an IP address is reserved, it will be associated with the project until it is released using 'gcloud compute addresses delete'. Ephemeral IP addresses that are in use by resources in the project can be reserved using the '--addresses' flag.

EXAMPLES

To reserve three IP addresses in the 'us-central1' region, run:

$ gcloud compute addresses create ADDRESS-1 ADDRESS-2 ADDRESS-3 \ --region=us-central1

To reserve ephemeral IP addresses '162.222.181.198' and '23.251.146.189' which are being used by virtual machine instances in the 'us-central1' region, run:

$ gcloud compute addresses create \ --addresses=162.222.181.198,23.251.146.189 --region=us-central1

In the above invocation, the two addresses will be assigned random names.

To reserve an IP address from the subnet 'default' in the 'us-central1' region, run:

$ gcloud compute addresses create SUBNET-ADDRESS-1 \ --region=us-central1 --subnet=default

To reserve an IP range '10.110.0.0/16' from the network 'default' for 'VPC_PEERING', run:

$ gcloud compute addresses create IP-RANGE-1 --global \ --addresses=10.110.0.0 --prefix-length=16 \ --purpose=VPC_PEERING --network=default

To reserve any IP range with prefix length '16' from the network 'default' for 'VPC_PEERING', run:

$ gcloud compute addresses create IP-RANGE-1 --global \ --prefix-length=16 --purpose=VPC_PEERING --network=default

To reserve an address from network 'default' for PRIVATE_SERVICE_CONNECT, run:

$ gcloud compute addresses create PSC-ADDRESS-1 --global \ --addresses=10.110.0.10 --purpose=PRIVATE_SERVICE_CONNECT \ --network=default

POSITIONAL ARGUMENTS

[NAME ...]

Names of the addresses to create.

FLAGS

--description=DESCRIPTION

An optional textual description for the addresses.

--endpoint-type=ENDPOINT_TYPE

The endpoint type of the external IPv6 address to be reserved. ENDPOINT_TYPE must be one of: VM, NETLB.

--network=NETWORK

If specified, the network resource in which the address(es) should be reserved.

This is only available for global internal address, which represents an internal IP range reservation from within the network.

--network-tier=NETWORK_TIER

The network tier to assign to the reserved IP addresses. NETWORK_TIER must be one of: PREMIUM, STANDARD, FIXED_STANDARD. The default value is PREMIUM.

While regional external addresses (--region specified, --subnet omitted) can use either PREMIUM or STANDARD, global external addresses (--global specified, --subnet omitted) can only use PREMIUM. Internal addresses can only use PREMIUM.

--prefix-length=PREFIX_LENGTH

The prefix length of the IP range. If the address is an IPv4 address, it must be a value between 8 and 30 inclusive. If the address is an IPv6 address, the only allowed value is 96. If not present, it means the address field is a single IP address.

This field is not applicable to external IPv4 addresses or global IPv6 addresses.

--purpose=PURPOSE

The purpose of the address resource. This field is not applicable to external addresses. PURPOSE must be one of: VPC_PEERING, SHARED_LOADBALANCER_VIP, GCE_ENDPOINT, IPSEC_INTERCONNECT, PRIVATE_SERVICE_CONNECT.

--subnet=SUBNET

If specified, the subnet name in which the address(es) should be reserved. The subnet must be in the same region as the address.

The address will represent an internal IP reservation from within the subnet. If --address is specified, it must be within the subnet's IP range.

May not be specified with --global.

At most one of these can be specified:
--addresses=ADDRESS,[ADDRESS,...]

Ephemeral IP addresses to promote to reserved status. Only addresses that are being used by resources in the project can be promoted. When providing this flag, a parallel list of names for the addresses can be provided. For example,

$ gcloud compute addresses create ADDRESS-1 ADDRESS-2 \ --addresses 162.222.181.197,162.222.181.198 \ --region us-central1

will result in 162.222.181.197 being reserved as 'ADDRESS-1' and 162.222.181.198 as 'ADDRESS-2'. If no names are given, server-generated names will be assigned to the IP addresses.

--ip-version=IP_VERSION

Version of the IP address to be allocated and reserved. The default is IPV4.

IP version can only be specified for global addresses that are generated automatically (i.e., along with the --global flag, given --addresses is not specified) and if the --network-tier is PREMIUM.

IP_VERSION must be one of: IPV4, IPV6.

At most one of these can be specified:
--global

If set, the addresses are global.

--region=REGION

Region of the addresses to create. Overrides the default compute/region property value for this command invocation.

GCLOUD WIDE FLAGS

These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.

Run $ gcloud help for details.

NOTES

These variants are also available:

$ gcloud alpha compute addresses create

$ gcloud beta compute addresses create