Skip to main content

postgresql_instances

Creates, updates, deletes, gets or lists a postgresql_instances resource.

Overview

Namepostgresql_instances
TypeResource
Idlinode.databases.postgresql_instances

Fields

The following fields are returned by SELECT queries:

Returns information for a single PostgreSQL Managed Database.

NameDatatypeDescription
idintegerRead-only A unique ID that can be used to identify and reference the Managed Database.
allow_listarrayControls access to the Managed Database. - Individually included IP addresses or CIDR ranges can access the Managed Database while all other sources are blocked. - A standalone value of 0.0.0.0/0 allows all IP addresses access to the Managed Database. - An empty array ([]) blocks all public and private connections to the Managed Database.
cluster_sizeintegerThe number of Linode instance nodes deployed to the Managed Database. - Choose 3 nodes to create a high availability cluster that consists of one primary node and two replica nodes. - A 2 node cluster is only available with a dedicated plan. It consists of one primary node and one replica node. (1, 2, 3)
createdstring (date-time)Read-only When this Managed Database was created. (example: 2022-01-01T00:01:01)
encryptedbooleanRead-only Whether the Managed Databases is encrypted. Currently required to be true.
enginestringFilterable, Read-only The Managed Database engine type. (example: postgresql)
engine_configobjectAdvanced parameters you can apply to a PostgreSQL Managed Database, via our partner Aiven's specification. Only include the objects for parameters you want to set in your database. Omit objects for parameters you don't want to define or change. > 📘 > > Aiven may offer additional parameters in their specification. Currently, only those listed here are supported for use in a PostgreSQL Managed Database. You can also run the List PostgreSQL Managed Database advanced parameters operation to see an up-to-date list.
forkobjectDetails on the database that was the target of the fork. This only exists if the database was restored by creating a fork from another MySQL or PostgreSQL database.
hostsobjectRead-only The primary and secondary hosts for the Managed Database. These are assigned after provisioning is complete.
labelstringFilterable A unique, user-defined string referring to the Managed Database. This string needs to be unique per Managed Database engine type. (example: example-db)
membersstringRead-only A mapping between IP addresses and strings designating them as primary or failover. (opaque JSON object)
oldest_restore_timestring (date-time)Read-only The oldest time to which a database can be restored. (example: 2024-10-03 20:48:05)
platformstringFilterable, Read-only The back-end platform for relational databases used by the service. (rdbms-legacy, rdbms-default) (example: rdbms-default)
portintegerRead-only The access port for this Managed Database.
private_networkobjectBeta Restricts access to a PostgreSQL Managed Database using a Virtual Private Cloud (VPC). Displayed as null if no VPC is configured.
regionstringFilterable The unique identifier for the region where the Managed Database lives. (example: us-east)
ssl_connectionbooleanCurrently required to be true. Whether to require SSL credentials to establish a connection to the Managed Database. Run the Get managed PostgreSQL database credentials operation for access information.
statusstringFilterable, Read-only The operating status of the Managed Database. (provisioning, active, suspending, suspended, resuming, failed, degraded, updating, resizing) (example: active)
total_disk_size_gbintegerRead-only The total disk size of the database, in GB.
typestringFilterable The Linode Instance type used by the Managed Database for its nodes. (example: g6-dedicated-2)
updatedstring (date-time)Read-only When this Managed Database was last updated. (example: 2022-01-01T00:01:01)
updatesobjectConfiguration settings for automated patch update maintenance for the Managed Database.
used_disk_size_gbintegerRead-only The amount of space currently in use in the database, in GB.
versionstringFilterable The Managed Database engine version. (example: 13.2)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectinstanceIdDisplay information for a single, accessible PostgreSQL Managed Database.

Learn more...

Learn more...
listselectpage, page_sizeDisplay all accessible PostgreSQL Managed Databases.

Learn more...

Learn more...
createinsertlabel, type, engine, regionProvision a PostgreSQL Managed Database

Use this operation to create a new PostgreSQL Managed Database.

- Restricted users need the add_databases user grant.

- New instances can take 10 to 15 minutes to deploy.

- When you create a new PostgreSQL Managed Database, our partner Aiven automatically enables disk encryption on each cluster.

- All Managed Databases include automatic, daily backups. Up to seven backups are automatically stored for each Managed Database, providing restore points for each day of the past week.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the PostgreSQL Managed Database. Configure the maintenance window for these updates with the Update a managed PostgreSQL database operation.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_create event.

Beta Virtual Private Cloud (VPC) support

You can create a PostgreSQL Managed Database in a VPC using the private_network object in the request. Talk to your Akamai account team for more details.

> 📘
>
> Currently, VPC subnets associated with Managed Database instances don't automatically block outbound connections outside the subnet. To limit network exposure, you should configure Cloud Firewall rules to explicitly deny outbound connections beyond the intended subnet. For more details on configuring rules, see the Cloud Firewall documentation.

Restore a PostgreSQL Managed Database

Include the fork object in the request to target a backed-up database. Your user needs read_write access to the target database and its status can be active, degraded, or failed.

> 📘
>
> Restoring from a backup creates a second running cluster, which incurs billing. Delete the first cluster after the restore is complete, to avoid this billing.

Learn more...

Learn more...
patchupdateinstanceIdApply security patches and updates to the underlying operating system of the PostgreSQL Managed Database. This function runs during regular maintenance windows, which you can configure with the Update a managed PostgreSQL database operation.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_upgrade event.

Learn more...

Learn more...
updatereplaceinstanceIdMake changes to an existing PostgreSQL Managed Database.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- New values set in the allow_list overwrite existing values. To keep existing values, run the List PostgreSQL Managed Databases operation, store the allow_list addresses from the response, and include them with any new addresses in this operation.

- Updates to your allow_list may take a short period of time to complete, making this operation inappropriate for rapid successive updates.

- Also allows resizing the database cluster to a larger one. Clusters can't be resized to smaller plans.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the Managed PostgreSQL Database. Use the updates object in this operation to modify the maintenance window for these updates.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Use the updates object to adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- You can't update engine_config advanced parameter settings for a suspended database. You'll need to resume it first.

- A successful request triggers a database_update event.

- Beta. You can update an existing PostgreSQL Managed Database to move it to a Virtual Private Cloud (VPC) using the private_network object in the request. This support is in beta. Talk to your Akamai account team for more details.

> 📘
>
> Currently, VPC subnets associated with Managed Database instances don't automatically block outbound connections outside the subnet. To limit network exposure, you should configure Cloud Firewall rules to explicitly deny outbound connections beyond the intended subnet. For more details on configuring rules, see the Cloud Firewall documentation.

Learn more...

Learn more...
deletedeleteinstanceIdRemove a PostgreSQL Managed Database from your account.

- The user needs read_write user grant access to the database.

- The database's status can be active, failed, or degraded.

- Only unrestricted users can access this operation. They have access regardless of the acting token's OAuth scopes.

Learn more...

Learn more...
resumeexecinstanceIdResume a suspended PostgreSQL Managed Database from your account. This resumes billing for the cluster.

- The user needs read_write user grant access to the database.

- The database's status needs to be suspended.

- A successful request triggers a database_resume event. OAuth scopes.

<br /> databases:read_write<br />

Learn more...
suspendexecinstanceIdSuspend a PostgreSQL Managed Database from your account, releasing idle resources and keeping only necessary data. All service data is lost if there are no backups available. This halts billing for the cluster.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- Akamai deletes suspended clusters after 180 days.

- A successful request triggers a database_suspend event. OAuth scopes.

<br /> databases:read_write<br />

Learn more...

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
instanceIdstringThe ID of the Managed PostgreSQL Database.
pageintegerThe page of a collection to return.
page_sizeintegerThe number of items to return per page.

SELECT examples

Display information for a single, accessible PostgreSQL Managed Database.

Learn more...

Learn more...

SELECT
id,
allow_list,
cluster_size,
created,
encrypted,
engine,
engine_config,
fork,
hosts,
label,
members,
oldest_restore_time,
platform,
port,
private_network,
region,
ssl_connection,
status,
total_disk_size_gb,
type,
updated,
updates,
used_disk_size_gb,
version
FROM linode.databases.postgresql_instances
WHERE instanceId = '{{ instanceId }}' -- required
;

INSERT examples

Provision a PostgreSQL Managed Database

Use this operation to create a new PostgreSQL Managed Database.

- Restricted users need the add_databases user grant.

- New instances can take 10 to 15 minutes to deploy.

- When you create a new PostgreSQL Managed Database, our partner Aiven automatically enables disk encryption on each cluster.

- All Managed Databases include automatic, daily backups. Up to seven backups are automatically stored for each Managed Database, providing restore points for each day of the past week.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the PostgreSQL Managed Database. Configure the maintenance window for these updates with the Update a managed PostgreSQL database operation.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_create event.

Beta Virtual Private Cloud (VPC) support

You can create a PostgreSQL Managed Database in a VPC using the private_network object in the request. Talk to your Akamai account team for more details.

> 📘
>
> Currently, VPC subnets associated with Managed Database instances don't automatically block outbound connections outside the subnet. To limit network exposure, you should configure Cloud Firewall rules to explicitly deny outbound connections beyond the intended subnet. For more details on configuring rules, see the Cloud Firewall documentation.

Restore a PostgreSQL Managed Database

Include the fork object in the request to target a backed-up database. Your user needs read_write access to the target database and its status can be active, degraded, or failed.

> 📘
>
> Restoring from a backup creates a second running cluster, which incurs billing. Delete the first cluster after the restore is complete, to avoid this billing.

Learn more...

Learn more...

INSERT INTO linode.databases.postgresql_instances (
allow_list,
cluster_size,
engine,
engine_config,
fork,
label,
private_network,
region,
ssl_connection,
type
)
SELECT
'{{ allow_list }}',
{{ cluster_size }},
'{{ engine }}' /* required */,
'{{ engine_config }}',
'{{ fork }}',
'{{ label }}' /* required */,
'{{ private_network }}',
'{{ region }}' /* required */,
{{ ssl_connection }},
'{{ type }}' /* required */
RETURNING
id,
allow_list,
cluster_size,
created,
encrypted,
engine,
engine_config,
fork,
hosts,
label,
members,
platform,
port,
region,
ssl_connection,
status,
total_disk_size_gb,
type,
updated,
updates,
used_disk_size_gb,
version
;

UPDATE examples

Apply security patches and updates to the underlying operating system of the PostgreSQL Managed Database. This function runs during regular maintenance windows, which you can configure with the Update a managed PostgreSQL database operation.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- A successful request triggers a database_upgrade event.

Learn more...

Learn more...

UPDATE linode.databases.postgresql_instances
SET
-- No updatable properties
WHERE
instanceId = '{{ instanceId }}' --required
RETURNING
instanceId,
message;

REPLACE examples

Make changes to an existing PostgreSQL Managed Database.

- The user needs read_write user grant access to the database.

- The database's status needs to be active.

- New values set in the allow_list overwrite existing values. To keep existing values, run the List PostgreSQL Managed Databases operation, store the allow_list addresses from the response, and include them with any new addresses in this operation.

- Updates to your allow_list may take a short period of time to complete, making this operation inappropriate for rapid successive updates.

- Also allows resizing the database cluster to a larger one. Clusters can't be resized to smaller plans.

- All Managed Databases include automatic updates, which apply security patches to the underlying operating system of the Managed PostgreSQL Database. Use the updates object in this operation to modify the maintenance window for these updates.

- If your database cluster is configured with a single node, downtime occurs during maintenance updates. Use the updates object to adjust the window to match a time that's the least disruptive to your application and users. Also consider upgrading to a high availability plan to avoid any maintenance downtime.

- Major upgrades are optional until the service reaches end of service, and can be done in place.

- You can't update engine_config advanced parameter settings for a suspended database. You'll need to resume it first.

- A successful request triggers a database_update event.

- Beta. You can update an existing PostgreSQL Managed Database to move it to a Virtual Private Cloud (VPC) using the private_network object in the request. This support is in beta. Talk to your Akamai account team for more details.

> 📘
>
> Currently, VPC subnets associated with Managed Database instances don't automatically block outbound connections outside the subnet. To limit network exposure, you should configure Cloud Firewall rules to explicitly deny outbound connections beyond the intended subnet. For more details on configuring rules, see the Cloud Firewall documentation.

Learn more...

Learn more...

REPLACE linode.databases.postgresql_instances
SET
allow_list = '{{ allow_list }}',
engine_config = '{{ engine_config }}',
label = '{{ label }}',
private_network = '{{ private_network }}',
type = '{{ type }}',
updates = '{{ updates }}',
version = '{{ version }}'
WHERE
instanceId = '{{ instanceId }}' --required
RETURNING
id,
allow_list,
cluster_size,
created,
encrypted,
engine,
engine_config,
fork,
hosts,
label,
members,
oldest_restore_time,
platform,
port,
private_network,
region,
ssl_connection,
status,
total_disk_size_gb,
type,
updated,
updates,
used_disk_size_gb,
version;

DELETE examples

Remove a PostgreSQL Managed Database from your account.

- The user needs read_write user grant access to the database.

- The database's status can be active, failed, or degraded.

- Only unrestricted users can access this operation. They have access regardless of the acting token's OAuth scopes.

Learn more...

Learn more...

DELETE FROM linode.databases.postgresql_instances
WHERE instanceId = '{{ instanceId }}' --required
;

Lifecycle Methods

Resume a suspended PostgreSQL Managed Database from your account. This resumes billing for the cluster.

- The user needs read_write user grant access to the database.

- The database's status needs to be suspended.

- A successful request triggers a database_resume event. OAuth scopes.

<br /> databases:read_write<br />

Learn more...

EXEC linode.databases.postgresql_instances.resume
@instanceId='{{ instanceId }}' --required
;