gcloud compute instances add-access-config

NAME
gcloud compute instances add-access-config - create a Compute Engine virtual machine access configuration
SYNOPSIS
gcloud compute instances add-access-configINSTANCE_NAME[--access-config-name=ACCESS_CONFIG_NAME; default="external-nat"][--address=ADDRESS][--network-interface=NETWORK_INTERFACE; default="nic0"][--network-tier=NETWORK_TIER][--zone=ZONE][--public-ptr    |--no-public-ptr][--public-ptr-domain=PUBLIC_PTR_DOMAIN    |--no-public-ptr-domain][GCLOUD_WIDE_FLAG]
DESCRIPTION
gcloud compute instances add-access-config is used to create accessconfigurations for network interfaces of Compute Engine virtual machines. Thisallows you to assign a public, external IP to a virtual machine.
EXAMPLES
To assign an public, externally accessible IP to a virtual machine namedexample-instance in zoneus-central1-a, run:
gcloudcomputeinstancesadd-access-configexample-instance--zone=us-central1-a

To assign the specific, reserved public IP address123.456.789.123 to the virtual machine,run:

gcloudcomputeinstancesadd-access-configexample-instance--zone=us-central1-a--address=123.456.789.123
POSITIONAL ARGUMENTS
INSTANCE_NAME
Name of the instance to operate on. For details on valid instance names, referto the criteria documented under the field 'name' at:https://cloud.google.com/compute/docs/reference/rest/v1/instances
FLAGS
--access-config-name=ACCESS_CONFIG_NAME; default="external-nat"
Specifies the name of the new access configuration.external-nat is used as the default if thisflag is not provided. Since ONE_TO_ONE_NAT is currently the only access-configtype, it is not recommended that you change this value.
--address=ADDRESS
Specifies the external IP address of the new access configuration. If this isnot specified, then the service will choose an available ephemeral IP address.If an explicit IP address is given, then that IP address must be reserved by theproject and not be in use by another resource.
--network-interface=NETWORK_INTERFACE; default="nic0"
Specifies the name of the network interface which contains the accessconfiguration. If this is not provided, then "nic0" is used as the default.
--network-tier=NETWORK_TIER
Specifies the network tier of the access configuration.NETWORK_TIER must be one of:PREMIUM,STANDARD. The default value isPREMIUM.
--zone=ZONE
Zone of the instance to operate on. If not specified, you might be prompted toselect a zone (interactive mode only).gcloud attempts to identify theappropriate zone by searching for resources in your currently active project. Ifthe zone cannot be determined,gcloud prompts you for a selection withall available Google Cloud Platform zones.

To avoid prompting when this flag is omitted, the user can set thecompute/zone property:

gcloudconfigsetcompute/zoneZONE

A list of zones can be fetched by running:

gcloudcomputezoneslist

To unset the property, run:

gcloudconfigunsetcompute/zone

Alternatively, the zone can be stored in the environment variableCLOUDSDK_COMPUTE_ZONE.

At most one of these can be specified:
--public-ptr
Creates a DNS PTR record for the external IP in the access configuration. Thisoption can only be specified for the default network-interface, "nic0".
--no-public-ptr
If provided, no DNS PTR record is created for the external IP in the accessconfiguration. Mutually exclusive with public-ptr-domain.
At most one of these can be specified:
--public-ptr-domain=PUBLIC_PTR_DOMAIN
Assigns a custom PTR domain for the external IP in the access configuration.Mutually exclusive with no-public-ptr. This option can only be specified for thedefault network-interface, "nic0".
--no-public-ptr-domain
If both this flag and --public-ptr are specified, creates a DNS PTR record forthe external IP in the access configuration with the PTR domain name being theDNS name of the instance.
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:
gcloudalphacomputeinstancesadd-access-config
gcloudbetacomputeinstancesadd-access-config

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.