gcloud compute addresses create - reserve IP addresses
gcloud compute addresses create [NAME ...] [--addresses ADDRESS,[ADDRESS,...]] [--description DESCRIPTION] [--global | --region REGION] [GLOBAL-FLAG ...]
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.
[NAME ...]The names to assign to the reserved IP addresses.
--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,--description DESCRIPTION
$ gcloud compute addresses create ADDRESS-1 ADDRESS-2 \
--addresses 188.8.131.52 184.108.40.206 \
will result in 220.127.116.11 being reserved as ADDRESS-1 and 18.104.22.168 as ADDRESS-2. If no names are given, randomly-generated names will be assigned to the IP addresses.
An optional textual description for the addresses.--global
If provided, it is assumed the addresses are global.--region REGION
The region of the address to operate on. If not specified, you will be prompted to select a region.
To avoid prompting when this flag is omitted, you can set the compute/region property:
$ gcloud config set compute/region REGION
A list of regions can be fetched by running:
$ gcloud compute regions list
To unset the property, run:
$ gcloud config unset compute/region
Alternatively, the region can be stored in the environment variable CLOUDSDK_COMPUTE_REGION.
Run $ gcloud help for a description of flags available to all commands.
To reserve three IP addresses in the us-central1 region, run:
$ gcloud compute addresses create ADDRESS-1 ADDRESS-2 ADDRESS-3 \
To reserve ephemeral IP addresses 22.214.171.124 and 126.96.36.199 which are being used by virtual machine instances in the us-central1 region, run:
$ gcloud compute addresses create --addresses 188.8.131.52 \
184.108.40.206 --region us-central1
In the above invocation, the two addresses will be assigned random names.