Configure an instance's database flags

Stay organized with collections Save and categorize content based on your preferences.

This page describes how to add database flags for an instance, modify database flags, and delete database flags from an instance in an AlloyDB cluster.

You use database flags for many operations, including adjusting PostgreSQL parameters, adjusting options, and configuring and tuning an instance.

In some cases, setting one flag may require that you set another flag to fully enable the desired functionality.

When you set, remove, or modify a flag for a database instance, the database might be restarted. The flag value is then persisted for the instance until you remove it.

Prerequisites

  • The Cloud project you are using must have been enabled to access AlloyDB.
  • You must have one of these IAM roles in the Cloud project you are using:
    • roles/alloydb.admin (the AlloyDB Admin predefined IAM role)
    • roles/owner (the Owner basic IAM role)
    • roles/editor (the Editor basic IAM role)

    If you don't have any of these roles, contact your Organization Administrator to request access.

Procedure

Console

  1. In the Google Cloud console, go to the Clusters page.

    Go to Clusters

  2. Click a cluster in the Resource Name column.
  3. In the Overview page, go to Instances in your cluster, select an instance, and then click Edit.
  4. Add, modify, or delete a database flag from your instance:
    • Add a flag
      1. To add a database flag to your instance, click Add flag.
      2. Select a flag from the New database flag list.
      3. Provide a value for the flag.
      4. Click Done.
    • Modify a flag
      1. To modify a database flag present in your instance, expand the database flag and modify the value of the existing flag in the Edit database flag section.
      2. Click Done.
    • Delete a flag
      1. To delete a database flag from your instance, select a flag and click the delete icon.
      2. Click Done.
  5. Click Update instance.

gcloud

To use the gcloud CLI, you can install and initialize the Google Cloud CLI, or you can use Cloud Shell.

Use the instances update command with the --database-flags option to change the database flags for an instance.

gcloud beta alloydb instances update INSTANCE_ID \
    --database-flags FLAGS_LIST \
    --region=REGION_ID \
    --cluster=CLUSTER_ID \
    --project=PROJECT_ID
  • INSTANCE_ID: The ID of the instance.
  • FLAGS_LIST: A comma-separated list of one or more database flag specifications. Each specification consists of the name of the flag, an equals sign (=), and the value to assign to the flags. For database flags that do not take values, provide the name of the flag followed by an equals sign (=).
  • REGION_ID: The region where the instance is placed.
  • CLUSTER_ID: The ID of the cluster where the instance is placed.
  • PROJECT_ID: The ID of the project where the cluster is placed.

Note that running this command overwrites all database flags previously set. Any database flag not explicitly included in the --database-flags list gets reset to its default value. To retain your instance's database flags while adding new ones, you must include both current and new flags in the --database-flags list.

To see a list of an instance's current, manually-set flags, run this command:

gcloud beta alloydb instances describe INSTANCE_ID \
    --region=REGION_ID \
    --cluster=CLUSTER_ID \
    --project=PROJECT_ID