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

# POST /v1/{+parent}/instances:createsecondary

`POST /v1/{+parent}/instances:createsecondary`

Creates a new SECONDARY Instance in a given project and location.

## Path parameters

- `parent` string, required

## Query parameters

- `instanceId` string
- `requestId` string
- `validateOnly` boolean

## Request body

- Instance — An Instance is a computing unit that an end customer can connect to. It's the main unit of computing resources in AlloyDB.
  - `satisfiesPzs` boolean — Output only. Reserved for future use.
  - `state` 'STATE_UNSPECIFIED' | 'READY' | 'STOPPED' | 'CREATING' | 'DELETING' | 'MAINTENANCE' | 'FAILED' | 'BOOTSTRAPPING' | 'PROMOTING' | 'SWITCHOVER' | 'STOPPING' | 'STARTING' — Output only. The current serving state of the instance.
  - `nodes` Node[] — Output only. List of available read-only VMs in this instance, including the standby for a PRIMARY instance.
    - `state` string — Output only. Determined by state of the compute VM and postgres-service health. Compute VM state can have values listed in https://cloud.google.com/compute/docs/instances/instance-life-cycle and postgres-service health can have values: HEALTHY and UNHEALTHY.
    - `ip` string — Output only. The private IP address of the VM e.g. "10.57.0.34".
    - `zoneId` string — Output only. The Compute Engine zone of the VM e.g. "us-central1-b".
    - `id` string — Output only. The identifier of the VM e.g. "test-read-0601-407e52be-ms3l".
    - `isHotStandby` boolean — Output only. Indicates whether the node set up to be configured as a hot standby.
  - `clientConnectionConfig` ClientConnectionConfig — Client connection configuration
    - `requireConnectors` boolean — Optional. Configuration to enforce connectors only (ex: AuthProxy) connections to the database.
    - `sslConfig` SslConfig — SSL configuration.
      - `sslMode` 'SSL_MODE_UNSPECIFIED' | 'SSL_MODE_ALLOW' | 'SSL_MODE_REQUIRE' | 'SSL_MODE_VERIFY_CA' | 'ALLOW_UNENCRYPTED_AND_ENCRYPTED' | 'ENCRYPTED_ONLY' — Optional. SSL mode. Specifies client-server SSL/TLS connection behavior.
      - `caSource` 'CA_SOURCE_UNSPECIFIED' | 'CA_SOURCE_MANAGED' — Optional. Certificate Authority (CA) source. Only CA_SOURCE_MANAGED is supported currently, and is the default value.
  - `displayName` string — User-settable and human-readable display name for the Instance.
  - `uid` string — Output only. The system-generated UID of the resource. The UID is assigned when the resource is created, and it is retained until it is deleted.
  - `outboundPublicIpAddresses` string[] — Output only. All outbound public IP addresses configured for the instance.
  - `etag` string — For Resource freshness validation (https://google.aip.dev/154)
  - `machineConfig` MachineConfig — MachineConfig describes the configuration of a machine.
    - `cpuCount` integer — The number of CPU's in the VM instance.
    - `machineType` string — Machine type of the VM instance. E.g. "n2-highmem-4", "n2-highmem-8", "c4a-highmem-4-lssd". cpu_count must match the number of vCPUs in the machine type.
  - `annotations` object — Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels. https://google.aip.dev/128
  - `gceZone` string — The Compute Engine zone that the instance should serve from, per https://cloud.google.com/compute/docs/regions-zones This can ONLY be specified for ZONAL instances. If present for a REGIONAL instance, an error will be thrown. If this is absent for a ZONAL instance, instance is created in a random zone with available capacity.
  - `connectionPoolConfig` ConnectionPoolConfig — Configuration for Managed Connection Pool (MCP).
    - `authproxyPoolerCount` integer — Output only. The number of running AuthProxy poolers per instance.
    - `poolerScalingType` 'POOLER_SCALING_TYPE_UNSPECIFIED' | 'POOLER_NONE' | 'POOLER_MACHINE_SIZED' | 'POOLER_MANUAL_OVERRIDE' — Optional. The scaling type of the regular pooler.
    - `enabled` boolean — Optional. Whether to enable Managed Connection Pool (MCP).
    - `authproxyPoolerScalingType` 'POOLER_SCALING_TYPE_UNSPECIFIED' | 'POOLER_NONE' | 'POOLER_MACHINE_SIZED' | 'POOLER_MANUAL_OVERRIDE' — Optional. The scaling type of the AuthProxy pooler.
    - `flags` object — Optional. Connection Pool flags, as a list of "key": "value" pairs.
    - `poolerCount` integer — Output only. The number of running poolers per instance.
  - `updateTime` string, google-datetime — Output only. Update time stamp
  - `dataApiAccess` 'DEFAULT_DATA_API_ENABLED_FOR_GOOGLE_CLOUD_SERVICES' | 'DISABLED' | 'ENABLED' — Optional. Controls whether the Data API is enabled for this instance. When enabled, this allows authorized users to connect to the instance from the public internet using the `executeSql` API, even for private IP instances. If this is not specified, the data API is enabled by default for Google internal services like AlloyDB Studio. Disable it explicitly to disallow Google internal services as well.
  - `pscInstanceConfig` PscInstanceConfig — PscInstanceConfig contains PSC related configuration at an instance level.
    - `allowedConsumerProjects` string[] — Optional. List of consumer projects that are allowed to create PSC endpoints to service-attachments to this instance.
    - `serviceAttachmentLink` string — Output only. The service attachment created when Private Service Connect (PSC) is enabled for the instance. The name of the resource will be in the format of `projects//regions//serviceAttachments/`
    - `pscDnsName` string — Output only. The DNS name of the instance for PSC connectivity. Name convention: ...alloydb-psc.goog
    - `pscInterfaceConfigs` PscInterfaceConfig[] — Optional. Configurations for setting up PSC interfaces attached to the instance which are used for outbound connectivity. Only primary instances can have PSC interface attached. Currently we only support 0 or 1 PSC interface.
      - `networkAttachmentResource` string — The network attachment resource created in the consumer network to which the PSC interface will be linked. This is of the format: "projects/${CONSUMER_PROJECT}/regions/${REGION}/networkAttachments/${NETWORK_ATTACHMENT_NAME}". The network attachment must be in the same region as the instance.
    - `pscAutoConnections` PscAutoConnectionConfig[] — Optional. Configurations for setting up PSC service automation.
      - `status` string — Output only. The status of the PSC service automation connection. Possible values: "STATE_UNSPECIFIED" - An invalid state as the default case. "ACTIVE" - The connection has been created successfully. "FAILED" - The connection is not functional since some resources on the connection fail to be created. "CREATING" - The connection is being created. "DELETING" - The connection is being deleted. "CREATE_REPAIRING" - The connection is being repaired to complete creation. "DELETE_REPAIRING" - The connection is being repaired to complete deletion.
      - `consumerProject` string — The consumer project to which the PSC service automation endpoint will be created.
      - `consumerNetwork` string — The consumer network for the PSC service automation, example: "projects/vpc-host-project/global/networks/default". The consumer network might be hosted a different project than the consumer project.
      - `ipAddress` string — Output only. The IP address of the PSC service automation endpoint.
      - `consumerNetworkStatus` string — Output only. The status of the service connection policy. Possible values: "STATE_UNSPECIFIED" - Default state, when Connection Map is created initially. "VALID" - Set when policy and map configuration is valid, and their matching can lead to allowing creation of PSC Connections subject to other constraints like connections limit. "CONNECTION_POLICY_MISSING" - No Service Connection Policy found for this network and Service Class "POLICY_LIMIT_REACHED" - Service Connection Policy limit reached for this network and Service Class "CONSUMER_INSTANCE_PROJECT_NOT_ALLOWLISTED" - The consumer instance project is not in AllowedGoogleProducersResourceHierarchyLevels of the matching ServiceConnectionPolicy.
  - `activationPolicy` 'ACTIVATION_POLICY_UNSPECIFIED' | 'ALWAYS' | 'NEVER' — Optional. Specifies whether an instance needs to spin up. Once the instance is active, the activation policy can be updated to the `NEVER` to stop the instance. Likewise, the activation policy can be updated to `ALWAYS` to start the instance. There are restrictions around when an instance can/cannot be activated (for example, a read pool instance should be stopped before stopping primary etc.). Please refer to the API documentation for more details.
  - `observabilityConfig` ObservabilityInstanceConfig — Observability Instance specific configuration.
    - `enabled` boolean — Observability feature status for an instance. This flag is turned "off" by default.
    - `trackActiveQueries` boolean — Track actively running queries on the instance. If not set, this flag is "off" by default.
    - `preserveComments` boolean — Preserve comments in query string for an instance. This flag is turned "off" by default.
    - `trackWaitEventTypes` boolean — Output only. Track wait event types during query execution for an instance. This flag is turned "on" by default but tracking is enabled only after observability enabled flag is also turned on. This is read-only flag and only modifiable by internal API.
    - `trackWaitEvents` boolean — Track wait events during query execution for an instance. This flag is turned "on" by default but tracking is enabled only after observability enabled flag is also turned on.
    - `maxQueryStringLength` integer — Query string length. The default value is 10k.
    - `recordApplicationTags` boolean — Record application tags for an instance. This flag is turned "off" by default.
    - `queryPlansPerMinute` integer — Number of query execution plans captured by Insights per minute for all queries combined. The default value is 200. Any integer between 0 to 200 is considered valid.
  - `availabilityType` 'AVAILABILITY_TYPE_UNSPECIFIED' | 'ZONAL' | 'REGIONAL' — Availability type of an Instance. If empty, defaults to REGIONAL for primary instances. For read pools, availability_type is always UNSPECIFIED. Instances in the read pools are evenly distributed across available zones within the region (i.e. read pools with more than one node will have a node in at least two zones).
  - `publicIpAddress` string — Output only. The public IP addresses for the Instance. This is available ONLY when enable_public_ip is set. This is the connection endpoint for an end-user application.
  - `readPoolConfig` ReadPoolConfig — Configuration for a read pool instance.
    - `nodeCount` integer — Read capacity, i.e. number of nodes in a read pool instance.
  - `name` string — Output only. The name of the instance resource with the format: * projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} where the cluster and instance ID segments should satisfy the regex expression `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`, e.g. 1-63 characters of lowercase letters, numbers, and dashes, starting with a letter, and ending with a letter or number. For more details see https://google.aip.dev/122. The prefix of the instance resource name is the name of the parent resource: * projects/{project}/locations/{region}/clusters/{cluster_id}
  - `reconciling` boolean — Output only. Reconciling (https://google.aip.dev/128#reconciliation). Set to true if the current state of Instance does not match the user's intended state, and the service is actively updating the resource to reconcile them. This can happen due to user-triggered updates or system actions like failover or maintenance.
  - `deleteTime` string, google-datetime — Output only. Delete time stamp
  - `writableNode` Node — Details of a single node in the instance. Nodes in an AlloyDB instance are ephemeral, they can change during update, failover, autohealing and resize operations.
    - `state` string — Output only. Determined by state of the compute VM and postgres-service health. Compute VM state can have values listed in https://cloud.google.com/compute/docs/instances/instance-life-cycle and postgres-service health can have values: HEALTHY and UNHEALTHY.
    - `ip` string — Output only. The private IP address of the VM e.g. "10.57.0.34".
    - `zoneId` string — Output only. The Compute Engine zone of the VM e.g. "us-central1-b".
    - `id` string — Output only. The identifier of the VM e.g. "test-read-0601-407e52be-ms3l".
    - `isHotStandby` boolean — Output only. Indicates whether the node set up to be configured as a hot standby.
  - `labels` object — Labels as key value pairs
  - `ipAddress` string — Output only. The IP address for the Instance. This is the connection endpoint for an end-user application.
  - `networkConfig` InstanceNetworkConfig — Metadata related to instance-level network configuration.
    - `authorizedExternalNetworks` AuthorizedNetwork[] — Optional. A list of external network authorized to access this instance.
      - `cidrRange` string — CIDR range for one authorzied network of the instance.
    - `enablePublicIp` boolean — Optional. Enabling public ip for the instance.
    - `network` string — Output only. The resource link for the VPC network in which instance resources are created and from which they are accessible via Private IP. This will be the same value as the parent cluster's network. It is specified in the form: // `projects/{project_number}/global/networks/{network_id}`.
    - `allocatedIpRangeOverride` string — Optional. Name of the allocated IP range for the private IP AlloyDB instance, for example: "google-managed-services-default". If set, the instance IPs will be created from this allocated range and will override the IP range used by the parent cluster. The range name must comply with [RFC 1035](https://datatracker.ietf.org/doc/html/rfc1035). Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?.
    - `enableOutboundPublicIp` boolean — Optional. Enabling an outbound public IP address to support a database server sending requests out into the internet.
  - `instanceType` 'INSTANCE_TYPE_UNSPECIFIED' | 'PRIMARY' | 'READ_POOL' | 'SECONDARY' — Required. The type of the instance. Specified at creation time.
  - `createTime` string, google-datetime — Output only. Create time stamp
  - `queryInsightsConfig` QueryInsightsInstanceConfig — QueryInsights Instance specific configuration.
    - `recordApplicationTags` boolean — Record application tags for an instance. This flag is turned "on" by default.
    - `recordClientAddress` boolean — Record client address for an instance. Client address is PII information. This flag is turned "on" by default.
    - `queryStringLength` integer — Query string length. The default value is 1024. Any integer between 256 and 4500 is considered valid.
    - `queryPlansPerMinute` integer — Number of query execution plans captured by Insights per minute for all queries combined. The default value is 5. Any integer between 0 and 20 is considered valid.
  - `maintenanceVersionName` string — Output only. Maintenance version of the instance, for example: POSTGRES_15.2025_07_15.04_00. Output only. Update this field via the parent cluster's maintenance_version field(s).
  - `databaseFlags` object — Database flags. Set at the instance level. They are copied from the primary instance on secondary instance creation. Flags that have restrictions default to the value at primary instance on read instances during creation. Read instances can set new flags or override existing flags that are relevant for reads, for example, for enabling columnar cache on a read instance. Flags set on read instance might or might not be present on the primary instance. This is a list of "key": "value" pairs. "key": The name of the flag. These flags are passed at instance setup time, so include both server options and system variables for Postgres. Flags are specified with underscores, not hyphens. "value": The value of the flag. Booleans are set to **on** for true and **off** for false. This field must be omitted if the flag doesn't take a value.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/alloydb.md) · [All operations](https://skmtc.net/google/apis/alloydb/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/alloydb/versions/cdbec2e3108c/schema)
