These examples show Azure as the cloud provider unless indicated otherwise.
Although the functionality is the same when using AWS or Google Cloud, there may be additional input flags based on the cloud provider type. Use the -h or --help flags for more information on the CLI commands.
Managing single-node and primary/standby high-availability clusters
Use the cluster commands to create, retrieve information on, and manage single-node and primary/standby high-availability clusters.
Create a cluster in interactive mode
The default mode for the cluster create and pgd create commands is an interactive mode that guides you through the required cluster configuration by providing you with the valid values.
Tip
You can turn off prompting using the biganimal config set interactive_mode off command. With prompting disabled, if any required flags are missing, the CLI exits with an error.
For example, to create a primary/standby high-availability cluster:
You're prompted to confirm that you want to create the cluster. After the cluster creation process is complete, it generates a cluster ID.
Check your cluster was created successfully using the cluster show command shown in the return message:
Create a cluster using a configuration file
You can use the create --config-file command to create one or more clusters with the same configuration in a noninteractive mode.
Here's a sample configuration file in YAML format with Azure specified as the provider:
Note
For backward compatibility, allowIpRangeMap and pgConfigMap properties also support embedded JSON format.
To create the cluster using the sample configuration file config_file.yaml:
To enable you to view valid values to use in the configuration file for Cloud Service and cloud service provider-related properties, the CLI provides a series of cluster subcommands. For example, you can use cluster show-architectures to list all Cloud Service database architectures available in your cloud service provider account:
Tip
You can turn off the confirmation step with the biganimal disable-confirm command.
Get cluster connection information
To use your Cloud Service cluster, you first need to get your cluster's connection information. To get your cluster's connection information, use the cluster show-connection command:
Tip
You can query the complete connection information with other output formats, like JSON or YAML. For example:
Update cluster
After the cluster is created, you can update attributes of the cluster, including both the cluster’s profile and its deployment architecture. You can update the following attributes:
Cluster name
Password of administrator account
Cluster architecture
Number of standby replicas
Instance type of cluster
Instance volume properties
Networking
Allowed IP list
Postgres database configuration
Volume properties, size, IOPS
Retention period
Read-only workloads
IAM authentication
Cloud service provider subscription IDs
Service account IDs
For example, to set the public allowed IP range list, use the --cidr-blocks flag:
To check whether the setting took effect, use the cluster show command, and view the detailed cluster information output in JSON format. For example:
Update the Postgres configuration of a cluster
To update the Postgres configuration of a Cloud Service cluster directly from the CLI:
To specify multiple configurations, you can use multiple --pg-config flags or include multiple configuration settings as a key-value array string separated by commas in one --pg-config flag. If a Postgres setting contains a comma, you need to specify it with a separate --pg-config flag.
Note
You can update the cluster architecture with the --cluster-architecture flag. The only supported scenario is to update a single-node cluster to a primary/standby high-availability cluster.
Delete a cluster
To delete a cluster you no longer need, use the cluster delete command. For example:
You can list all deleted clusters using the biganimal cluster show --deleted command and restore them from their history backups as needed.
Restore a cluster
Cloud Service continuously backs up your PostgreSQL clusters. Using the CLI, you can restore a cluster from its backup to any point in time as long as the backups are retained in the backup storage. The restored cluster can be in another region and have different configurations. You can specify new configurations in the cluster restore command. For example:
The password for the restored cluster is mandatory. The other parameters, if not specified, inherit the source database's settings.
To restore a deleted cluster, use the --from-deleted flag in the command.
Note
You can restore a cluster in a single cluster to a primary/standby high-availability cluster and vice versa. You can restore a distributed high-availability cluster only to a cluster using the same architecture.
Pause a cluster
To pause a cluster, use the cluster pause command. The cluster pause command supports flag or interactive mode. The syntax for the command is:
Where:
id is a valid cluster ID.
provider is a cloud provider of the cluster.
region is the cluster region.
name is the name of the cluster.
If you don't know the id of the cluster, use --provider --region --name to identify the cluster.
The following examples show common uses of the cluster pause command.
To pausing a cluster using the ID:
To pause a cluster using the name, provider, and region:
To pause a cluster in interactive mode:
Resume a cluster
To resume a cluster, use the cluster resume command. The cluster resume command supports flag and interactive mode. The syntax for the command is:
Where:
id is a valid cluster ID.
provider is a cloud provider of the cluster.
region is the cluster region.
name is the name of the cluster.
If you don't know the id of the cluster, use --provider --region --name to identify the cluster.
The following examples show common uses of the cluster resume command.
To resume a cluster using the ID:
To resuming a cluster using the name, provider, and region:
To resume a cluster using interactive mode:
Managing distributed high-availability clusters
Use the Cloud Service pgd commands to create, retrieve information on, and manage distributed high-availability clusters.
Note
In addition to the Cloud Service pgd commands, you can switch over and use commands available in the EDB Postgres Distributed CLI to perform PGD-specific operations. The only EDB Postgres Distributed CLI commands that don't apply to Cloud Service are create-proxy and delete-proxy.
Create a distributed high-availability cluster
Create a distributed high-availability cluster using a YAML configuration file.
The syntax of the command is:
Where <config_file> is a valid path to a YAML configuration file.
Azure example
AWS example
Google Cloud example
Add a data group
Add a data group using a YAML configuration file.
The syntax of the command is:
Where <config_file> is a valid path to a YAML configuration file. For example:
Update a distributed high-availability cluster
Update a distributed high-availability cluster and its data groups using a YAML configuration file.
The syntax of the command is:
Where <config_file> is a valid path to a YAML configuration file with the same format as a configuration file for creating a distributed high-availability cluster. See Create a distributed high-availability cluster.
Show distributed high-availability clusters
Show all active clusters or a specific cluster. You can also optionally show deleted clusters.
The syntax of the command is:
Restore a distributed high-availability cluster
Restore a distributed high-availability cluster or a deleted distributed high-availability cluster to a new cluster on the same cloud provider. You can restore an active cluster or a deleted cluster within its retention period. You can restore only one data group. By default, the new cluster inherits all settings of the source cluster. You can change the cluster setting and database configurations by specifying new values in the configuration file.
The syntax of the command is:
Where <config_file> is a valid path to a YAML configuration file. For example:
Get distributed high-availability cluster connection information
To connect to and use your Cloud Service distributed high-availability cluster, you first need to get your cluster group's connection information.
The syntax of the command is:
Delete a distributed high-availability cluster
Delete a specific Cloud Service distributed high-availability cluster.
The syntax of the command is:
The --id and --group-id flags are mandatory. For example:
Pause a distributed high-availability cluster
To pause a distributed high-availability cluster, use the pgd pause command. The pgd pause command supports flag mode only. The syntax for the command is:
Where id is a valid cluster ID. The id is mandatory.
For example:
Resume a distributed high-availability cluster
To resume a distributed high-availability cluster, use the pgd resume command. The pgd resume command supports flag mode only. The syntax for the command is:
Where id is a valid cluster ID. The id is mandatory.