Scaleway logo
Commands

Documentation for `scw rdb`

The CLI documentation pages are currently under construction

The content is up to date. We're making improvements to the site over the next few weeks for a better experience.

This API allows you to manage your Managed Databases for PostgreSQL and MySQL.

Access Control List (ACL) management commands

Network Access Control Lists allow you to control incoming network traffic by setting up ACL rules.

Add an ACL rule to a Database Instance

Add an additional ACL rule to a Database Instance.

Usage:

TerminalCode
scw rdb acl add <acl-rule-ips ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
acl-rule-ipsIP addresses defined in the ACL rules of the Database Instance
instance-idID of the Database InstanceRequired
descriptionDescription of the ACL rule. If multiple IPs are provided, this description will be applied to all rules unless specific descriptions are provided.
descriptionsDescriptions of the ACL rules
regionRegion to target. If none is passed will use default region from the configDefault: fr-par

Delete ACL rules of a Database Instance

Delete one or more ACL rules of a Database Instance.

Usage:

TerminalCode
scw rdb acl delete <acl-rule-ips ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
acl-rule-ipsIP addresses defined in the ACL rules of the Database Instance
instance-idID of the Database InstanceRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par

Edit a database instance's ACL

This command starts your default editor to edit a marshaled version of your resource Default editor will be taken from $VISUAL, then $EDITOR or an editor based on your system

Usage:

TerminalCode
scw rdb acl edit <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idID of the Database InstanceRequired
modemarshaling used when editing dataDefault: yaml
One of: yaml, json
regionRegion to target. If none is passed will use default region from the configDefault: fr-par

List ACL rules of a Database Instance

List the ACL rules for a given Database Instance. The response is an array of ACL objects, each one representing an ACL that denies, allows or redirects traffic based on certain conditions.

Usage:

TerminalCode
scw rdb acl list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database InstanceRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

Set ACL rules for a Database Instance

Replace all the ACL rules of a Database Instance.

Usage:

TerminalCode
scw rdb acl set <acl-rule-ips ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
acl-rule-ipsIP addresses defined in the ACL rules of the Database Instance
instance-idID of the Database InstanceRequired
descriptionsDescriptions of the ACL rules
regionRegion to target. If none is passed will use default region from the configDefault: fr-par

Backup management commands

A database backup is a dated export of a Database Instance stored on an offsite backend located in a different region than your database, by default. Once a backup is created, it can be used to restore the database. Each logical database in a Database Instance is backed up and can be restored separately.

Create a database backup

Create a new backup. You must set the instance_id, database_name, name and expires_at parameters.

Usage:

TerminalCode
scw rdb backup create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database InstanceRequired
database-nameName of the database you want to back upRequired
nameName of the backupDefault: <generated>
expires-atExpiration date (must follow the ISO 8601 format)
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete a database backup

Delete a backup, specified by its database backup ID and region. Deleting a backup is permanent, and cannot be undone.

Usage:

TerminalCode
scw rdb backup delete <database-backup-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
database-backup-idUUID of the database backup to deleteRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Download a backup locally

Download a backup locally.

Usage:

TerminalCode
scw rdb backup download <backup-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
backup-idID of the backup you want to download.Required
outputFilename to write to
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams

Examples:

Download a backup

TerminalCode
scw rdb backup download 11111111-1111-1111-1111-111111111111

Export a database backup

Export a backup, specified by the database_backup_id and the region parameters. The download URL is returned in the response.

Usage:

TerminalCode
scw rdb backup export <database-backup-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
database-backup-idUUID of the database backup you want to exportRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Get a database backup

Retrieve information about a given backup, specified by its database backup ID and region. Full details about the backup, like size, URL and expiration date, are returned in the response.

Usage:

TerminalCode
scw rdb backup get <database-backup-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
database-backup-idUUID of the database backupRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

List database backups

List all backups in a specified region, for a given Scaleway Organization or Scaleway Project. By default, the backups listed are ordered by creation date in ascending order. This can be modified via the order_by field.

Usage:

TerminalCode
scw rdb backup list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameName of the database backups
order-byCriteria to use when ordering database backups listingOne of: created_at_asc, created_at_desc, name_asc, name_desc, status_asc, status_desc
instance-idUUID of the Database Instance
project-idProject ID of the Project the database backups belong to
organization-idOrganization ID of the Organization the database backups belong to
created-beforeOnly list backups created before this date. Supports absolute RFC3339 timestamps and relative times (see scw help date).
created-afterOnly list backups created after this date. Supports absolute RFC3339 timestamps and relative times (see scw help date).
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

Restore a database backup

Launch the process of restoring database backup. You must specify the instance_id of the Database Instance of destination, where the backup will be restored. Note that large database backups can take up to several hours to restore.

Usage:

TerminalCode
scw rdb backup restore <database-backup-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
database-nameDefines the destination database to restore into a specified database (the default destination is set to the origin database of the backup)
database-backup-idBackup of a logical databaseRequired
instance-idDefines the Database Instance where the backup has to be restoredRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Update a database backup

Update the parameters of a backup, including name and expiration date.

Usage:

TerminalCode
scw rdb backup update <database-backup-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
database-backup-idUUID of the database backup to updateRequired
nameName of the Database Backup
expires-atExpiration date (must follow the ISO 8601 format)
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Wait for a backup to reach a stable state

Wait for a backup to reach a stable state. This is similar to using --wait flag.

Usage:

TerminalCode
scw rdb backup wait <backup-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
backup-idID of the backup you want to wait for.Required
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams
timeoutTimeout of the waitDefault: 20m0s

Examples:

Wait for a backup to reach a stable state

TerminalCode
scw rdb backup wait 11111111-1111-1111-1111-111111111111

Database client configuration snippets

Generate ready-to-use database client configuration snippets.

Generate a database client configuration snippet

Generate a ready-to-use database client configuration snippet for a Database Instance.

Supported languages:

  • php: PHP connection snippet (pg_connect for PostgreSQL, PDO for MySQL).
  • node: Node.js connection snippet (pg or mysql2).
  • typescript: TypeScript connection snippet (pg or mysql2).
  • python: Python connection snippet (psycopg2 or mysql.connector).
  • go: Go connection snippet (database/sql with pgx or go-sql-driver/mysql).
  • rust: Rust connection snippet (sqlx).

Use private-network=true when the instance has no public endpoint and is reachable only from resources attached to its Private Network. Replace YOUR_PASSWORD with your database user password, or use environment variables where suggested in the snippet.

Usage:

TerminalCode
scw rdb config get <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idID of the Database InstanceRequired
typeConfiguration template typeRequired
One of: php, node, typescript, python, go, rust
userDatabase user to connect as
dbDatabase name to connect to (defaults to rdb)
private-networkUse the Private Network endpoint instead of the public one
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Examples:

Generate a PHP connection snippet

TerminalCode
scw rdb config get 11111111-1111-1111-1111-111111111111 type=php

Generate a Node.js connection snippet for a custom user and database

TerminalCode
scw rdb config get 11111111-1111-1111-1111-111111111111 type=node user=myuser db=mydb

Generate a Python connection snippet using the Private Network endpoint

TerminalCode
scw rdb config get 11111111-1111-1111-1111-111111111111 type=python private-network=true

Generate a Go connection snippet

TerminalCode
scw rdb config get 11111111-1111-1111-1111-111111111111 type=go

Generate a Rust connection snippet

TerminalCode
scw rdb config get 11111111-1111-1111-1111-111111111111 type=rust

Database management commands

Databases can be used to store and manage sets of structured information, or data. The interaction between the user and a database is done using a Database Engine, which provides a structured query language to add, modify or delete information from the database.

Create a database in a Database Instance

Create a new database. You must define the name parameter in the request.

Usage:

TerminalCode
scw rdb database create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance where to create the databaseRequired
nameName of the database
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete a database in a Database Instance

Delete a given database on a Database Instance. You must specify, in the endpoint, the region, instance_id and name parameters of the database you want to delete.

Usage:

TerminalCode
scw rdb database delete [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance where to delete the databaseRequired
nameName of the database to deleteRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Gets the URL to connect to the Database

Provides the URL to connect to a Database on an Instance as the given user

Usage:

TerminalCode
scw rdb database get-url <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idID of the Database InstanceRequired
userUser of the Database
dbName of the Database to connect to

List databases in a Database Instance

List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as name, managed and owner.

Usage:

TerminalCode
scw rdb database list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameName of the database
managedDefines whether or not the database is managed
ownerUser that owns this database
order-byCriteria to use when ordering database listingOne of: name_asc, name_desc, size_asc, size_desc
instance-idUUID of the Database Instance to list the databases ofRequired
skip-size-retrievalWhether to skip the retrieval of each database size. If true, the size of each returned database will be set to 0
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

Endpoint management

A point of connection to a Database Instance. The endpoint is associated with an IPv4 address and a port. It contains the information about whether the endpoint is read-write or not. The endpoints always point to the main node of a Database Instance.

All endpoints have TLS enabled. You can use TLS to make your data and your passwords unreadable in transit to anyone but you.

For added security, you can set up ACL rules to restrict access to your endpoint to a set of trusted hosts or networks of your choice.

Load Balancers are used to forward traffic to the right node based on the node state (active/hot standby). The Load Balancers' configuration is set to cut off inactive connections if no TCP traffic is sent within a 6-hour timeframe. We recommend using connection pooling on the application side to renew database connections regularly.

Create a new Database Instance endpoint

Create a new endpoint for a Database Instance. You can add load_balancer and private_network specifications to the body of the request.

Usage:

TerminalCode
scw rdb endpoint create <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance to which you want to add an endpointRequired
private-network.private-network-idUUID of the Private Network to be connected to the Database Instance
private-network.service-ipEndpoint IPv4 address with a CIDR notation. Refer to the official Scaleway documentation to learn more about IP and subnet limitations.
private-network.enable-ipamWill configure your Private Network endpoint with Scaleway IPAM service if trueDefault: true
load-balancerWill configure a public Load-Balancer endpointDefault: true
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete a Database Instance endpoint

Delete the endpoint of a Database Instance. You must specify the region and endpoint_id parameters of the endpoint you want to delete. Note that might need to update any environment configurations that point to the deleted endpoint.

Usage:

TerminalCode
scw rdb endpoint delete <endpoint-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance from which you want to delete an endpointRequired
endpoint-idUUID of the endpoint you want to deleteRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Get a Database Instance endpoint

Retrieve information about a Database Instance endpoint. Full details about the endpoint, like ip, port, private_network and load_balancer specifications are returned in the response.

Usage:

TerminalCode
scw rdb endpoint get <endpoint-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
endpoint-idUUID of the endpoint you want to getRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Lists a Database Instance's endpoints

Lists all public and private endpoints of a Database Instance

Usage:

TerminalCode
scw rdb endpoint list <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idID of the Database InstanceRequired

Migrate an existing instance endpoint to another instance

Migrate an existing instance endpoint to another instance.

Usage:

TerminalCode
scw rdb endpoint migrate [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
endpoint-idUUID of the endpoint you want to migrateRequired
instance-idUUID of the instance you want to attach the endpoint toRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Database engines commands

A database engine is the software component that stores and retrieves your data from a database.

List available database engines

List the PostgreSQL and MySQL database engines available at Scaleway.

Usage:

TerminalCode
scw rdb engine list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameName of the database engine
versionVersion of the database engine
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

List available settings from an engine.

List available settings from an engine.

Usage:

TerminalCode
scw rdb engine settings [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameThe name of your engine where you want list the available settings.Required
versionThe version of the engine.Required
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Examples:

List Engine Settings

TerminalCode
scw rdb engine settings name=MySQL version=8

Instance management commands

A Database Instance is made up of one or multiple dedicated compute nodes running a single database engine. Two node settings are available: High-Availability (HA), with a main node and one replica, and standalone with a main node. The HA standby node is linked to the main node, using synchronous replication. Synchronous replication offers the ability to confirm that all changes intended by a transaction have been transferred and applied to the synchronous replica node, providing durability to the data.

Note: HA standby nodes are not accessible to users unless the main node becomes unavailable and the standby takes over. If you wish to run queries on a read-only node, you can use Read Replicas

Read Replicas can be used for certain read-only workflows such as Business Intelligence, or for a read-only scaling of your application. Read Replicas use asynchronous replication to replicate data from the main node.

Clone a Database Instance

Clone a given Database Instance, specified by the region and instance_id parameters. The clone feature allows you to create a new Database Instance from an existing one. The clone includes all existing databases, users and permissions. You can create a clone on a Database Instance bigger than your current one.

Usage:

TerminalCode
scw rdb instance clone <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want to cloneRequired
nameName of the Database Instance clone
node-typeNode type of the clone
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Connect to an instance using locally installed CLI

Connect to an instance using locally installed CLI such as psql or mysql.

Usage:

TerminalCode
scw rdb instance connect <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
private-networkConnect by the private network endpoint attached.Default: false
instance-idUUID of the instanceRequired
usernameName of the user to connect with to the databaseRequired
databaseName of the databaseDefault: rdb
cli-dbCommand line tool to use, default to psql/mysql
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams

Create a Database Instance

Create a new Database Instance. You must set the engine, user_name, password and node_type parameters. Optionally, you can specify the volume type and size.

Usage:

TerminalCode
scw rdb instance create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
project-idProject ID to use. If none is passed the default project ID will be used
nameName of the Database InstanceDefault: <generated>
engineDatabase engine of the Database Instance (PostgreSQL, MySQL, ...)Required
user-nameUsername created when the Database Instance is createdRequired
generate-passwordWill generate a 21 character-length password that contains a mix of upper/lower case letters, numbers and special symbolsDefault: true
passwordPassword of the user. Password must be between 8 and 128 characters, contain at least one digit, one uppercase, one lowercase and one special character
node-typeType of node to use for the Database InstanceRequired
Default: DB-DEV-S
is-ha-clusterDefines whether or not High-Availability is enabledDeprecated
high-availability-modeDefines the High-Availability mode of the instanceOne of: unknown_high_availability_mode, disabled, single_zone, multiple_zone
disable-backupDefines whether or not backups are disabled
tags.{index}Tags to apply to the Database Instance
init-settings.{index}.name
init-settings.{index}.value
volume-typeType of volume where data is stored (lssd, bssd, ...)One of: lssd, bssd, sbs_5k, sbs_15k
volume-sizeVolume size when volume_type is not lssd
init-endpoints.{index}.load-balancerLoad balancer endpoint specifications. Public endpoint for Database Instance which is systematically present. One per RDB instance
init-endpoints.{index}.load-balancerWill configure a load-balancer endpoint along with your private network endpoint if trueDefault: false
init-endpoints.{index}.private-network.enable-ipamWill configure your Private Network endpoint with Scaleway IPAM service if true
init-endpoints.{index}.private-network.private-network-idUUID of the Private Network to be connected to the Database Instance
init-endpoints.{index}.private-network.service-ipEndpoint IPv4 address with a CIDR notation. Refer to the official Scaleway documentation to learn more about IP and subnet limitations.
init-endpoints.{index}.private-network.ipam-configAutomated configuration of your Private Network endpoint with Scaleway IPAM service. One at the most per Database Instance or Read Replica (a Database Instance and its Read Replica can have different Private Networks). Cannot be updated (has to be deleted and recreated)
backup-same-regionDefines whether to or not to store logical backups in the same region as the Database Instance
encryption.enabled
organization-idOrganization ID to use. If none is passed the default organization ID will be used
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete a Database Instance

Delete a given Database Instance, specified by the region and instance_id parameters. Deleting a Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost.

Usage:

TerminalCode
scw rdb instance delete <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance to deleteRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Get a Database Instance

Retrieve information about a given Database Instance, specified by the region and instance_id parameters. Its full details, including name, status, IP address and port, are returned in the response object.

Usage:

TerminalCode
scw rdb instance get <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database InstanceRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Get the TLS certificate of a Database Instance

Retrieve information about the TLS certificate of a given Database Instance. Details like name and content are returned in the response.

Usage:

TerminalCode
scw rdb instance get-certificate <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database InstanceRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

[deprecated] Get Database Instance metrics

Retrieve the time series metrics of a given Database Instance. You can define the period from which to retrieve metrics by specifying the start_date and end_date. This method is deprecated and will be removed in a future version.

Usage:

TerminalCode
scw rdb instance get-metrics <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database InstanceRequired
start-dateStart date to gather metrics from
end-dateEnd date to gather metrics from
metric-nameName of the metric to gather
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

List Database Instances

List all Database Instances in the specified region, for a given Scaleway Organization or Scaleway Project. By default, the Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as tags and name. For the name parameter, the value you include will be checked against the whole name string to see if it includes the string you put in the parameter.

Usage:

TerminalCode
scw rdb instance list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
tags.{index}List Database Instances that have a given tag
nameLists Database Instances that match a name pattern
order-byCriteria to use when ordering Database Instance listingsOne of: created_at_asc, created_at_desc, name_asc, name_desc, region, status_asc, status_desc
project-idProject ID to list the Database Instance of
has-maintenancesFilter to only list instances with a scheduled maintenance
organization-idPlease use project_id instead
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

Renew the TLS certificate of a Database Instance

Renew a TLS for a Database Instance. Renewing a certificate means that you will not be able to connect to your Database Instance using the previous certificate. You will also need to download and update the new certificate for all database clients.

Usage:

TerminalCode
scw rdb instance renew-certificate <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want logs ofRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Restart Database Instance

Restart a given Database Instance, specified by the region and instance_id parameters. The status of the Database Instance returned in the response.

Usage:

TerminalCode
scw rdb instance restart <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want to restartRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Update an instance

Update an instance.

Usage:

TerminalCode
scw rdb instance update <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
backup-schedule-frequencyIn hours
backup-schedule-retentionIn days
is-backup-schedule-disabledWhether or not the backup schedule is disabled
nameName of the instance
instance-idUUID of the instance to updateRequired
tags.{index}Tags of a given instance
logs-policy.max-age-retentionMax age (in day) of remote logs to keep on the database instance
logs-policy.total-disk-retentionMax disk size of remote logs to keep on the database instance
backup-same-regionStore logical backups in the same region as the database instance
settings.{index}.nameSetting name of a given instance
settings.{index}.valueSetting value of a given instance
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Examples:

Update instance name

TerminalCode
scw rdb instance update 11111111-1111-1111-1111-111111111111 name=foo --wait

Update instance tags

TerminalCode
scw rdb instance update 11111111-1111-1111-1111-111111111111 tags.0=a --wait

Set a timezone

TerminalCode
scw rdb instance update 11111111-1111-1111-1111-111111111111 settings.0.name=timezone settings.0.value=UTC --wait

Upgrade a Database Instance

Upgrade your current Database Instance specifications like node type, high availability, volume, or the database engine version. Note that upon upgrade the enable_ha parameter can only be set to true.

Usage:

TerminalCode
scw rdb instance upgrade <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want to upgradeRequired
node-typeNode type of the Database Instance you want to upgrade to
enable-haDefines whether or not high availability should be enabled on the Database InstanceDeprecated
high-availability-modeDefines the High-Availability mode of the instanceOne of: unknown_high_availability_mode, disabled, single_zone, multiple_zone
volume-sizeIncrease your block storage volume size
volume-typeChange your Database Instance storage typeOne of: lssd, bssd, sbs_5k, sbs_15k
upgradable-version-idUpdate your database engine to a newer version
major-upgrade-workflow.upgradable-version-idUpdate your database engine to a newer version
major-upgrade-workflow.with-endpointsInclude endpoint during the migration
enable-encryptionDefines whether or not encryption should be enabled on the Database Instance
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Wait for an instance to reach a stable state

Wait for an instance to reach a stable state. This is similar to using --wait flag.

Usage:

TerminalCode
scw rdb instance wait <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idID of the instance you want to wait for.Required
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams
timeoutTimeout of the waitDefault: 20m0s

Examples:

Wait for an instance to reach a stable state

TerminalCode
scw rdb instance wait 11111111-1111-1111-1111-111111111111

Instance logs management commands

Instance logs management commands.

Download logs from a database instance

Prepare, wait for, and download logs from a Database Instance. This command automatically prepares the logs, waits for them to be ready, and downloads them to a file.

Usage:

TerminalCode
scw rdb log download <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want logs ofRequired
fromStart datetime of your log. Supports absolute RFC3339 timestamps and relative times (see scw help date).
toEnd datetime of your log. Supports absolute RFC3339 timestamps and relative times (see scw help date).
outputFilename to write to
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Examples:

Download logs from a database instance

TerminalCode
scw rdb log download 11111111-1111-1111-1111-111111111111

Download logs with a time range

TerminalCode
scw rdb log download 11111111-1111-1111-1111-111111111111 from=2023-01-01T00:00:00Z to=2023-01-02T00:00:00Z

Download logs to a specific file

TerminalCode
scw rdb log download 11111111-1111-1111-1111-111111111111 output=myLogs.txt

Get given logs of a Database Instance

Retrieve information about the logs of a Database Instance. Specify the instance_log_id and region in your request to get information such as download_url, status, expires_at and created_at about your logs in the response.

Usage:

TerminalCode
scw rdb log get [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-log-idUUID of the instance_log you wantRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

List available logs of a Database Instance

List the available logs of a Database Instance. By default, the logs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw rdb log list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want logs ofRequired
order-byCriteria to use when ordering Database Instance logs listingOne of: created_at_asc, created_at_desc
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

List remote Database Instance logs details

List remote log details. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw rdb log list-details [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want logs ofRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Prepare logs of a Database Instance

Prepare your Database Instance logs. You can define the start_date and end_date parameters for your query. The download URL is returned in the response. Logs are recorded from 00h00 to 23h59 and then aggregated in a .log file once a day. Therefore, even if you specify a timeframe from which you want to get the logs, you will receive logs from the full 24 hours.

Usage:

TerminalCode
scw rdb log prepare [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want logs ofRequired
start-dateStart datetime of your log. (RFC 3339 format)
end-dateEnd datetime of your log. (RFC 3339 format)
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Purge remote Database Instance logs

Purge a given remote log from a Database Instance. You can specify the log_name of the log you wish to clean from your Database Instance.

Usage:

TerminalCode
scw rdb log purge [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want logs ofRequired
log-nameGiven log name to purge
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Node types management commands

Two node type ranges are available:

  • General Purpose: production-grade nodes designed for scalable database infrastructures.
  • Development: sandbox environments and reliable performance for development and testing purposes.

List available node types

List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw rdb node-type list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
include-disabled-typesDefines whether or not to include disabled types
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

User privileges management commands

Privileges are permissions that can be granted to database users. You can manage user permissions either via the console, the Scaleway APIs or SQL. Managed Database for PostgreSQL and MySQL provides a simplified and unified permission model through the API and the console to make things easier to manage and understand.

Each user has associated permissions that give them access to zero or more logical databases. These include:

  • None: No access to the database
  • Read: Allow users to read tables and fields in a database
  • Write: Allow users to write content in databases.
  • Admin: Read and write access to the data, and extended privileges depending on the database engine.

List user privileges for a database

List privileges of a user on a database. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as database_name and user_name.

Usage:

TerminalCode
scw rdb privilege list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
order-byCriteria to use when ordering privileges listingOne of: user_name_asc, user_name_desc, database_name_asc, database_name_desc
database-nameName of the database
instance-idUUID of the Database InstanceRequired
user-nameName of the user
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

Set user privileges for a database

Set the privileges of a user on a database. You must define database_name, user_name and permission in the request body.

Usage:

TerminalCode
scw rdb privilege set [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database InstanceRequired
database-nameName of the database
user-nameName of the user
permissionPermission to set (Read, Read/Write, All, Custom)One of: readonly, readwrite, all, custom, none
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Read replica management

A Read Replica is a live copy of a Database Instance that behaves like an Instance, but that only allows read-only connections. The replica mirrors the data of the primary Database node and any changes made are replicated to the replica asynchronously. Read Replicas allow you to scale your Database Instance for read-heavy database workloads. They can also be used for business intelligence workloads.

A Read Replica can have at most one direct access and one Private Network endpoint. Loadbalancer endpoints are not available on Read Replicas even if this resource is displayed in the Read Replica response example.

If you want to remove a Read Replica endpoint, you can use delete a Database Instance endpoint API call.

Instance Access Control Lists (ACL) also apply to Read Replica direct access endpoints.

Limitations: There might be replication lags between the primary node and its Read Replica nodes. You can try to reduce this lag with some good practices:

  • All your tables should have a primary key
  • Don't run large transactions that modify, delete or insert lots of rows. Try to split it into several small transactions.

Create a Read Replica

Create a new Read Replica of a Database Instance. You must specify the region and the instance_id. You can only create a maximum of 3 Read Replicas per Database Instance.

Usage:

TerminalCode
scw rdb read-replica create <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want to create a Read Replica fromRequired
endpoint-spec.{index}.direct-accessDirect access endpoint specifications. Public endpoint reserved for Read Replicas. One per Read Replica
endpoint-spec.{index}.private-network.private-network-idUUID of the Private Network to be connected to the Read Replica
endpoint-spec.{index}.private-network.service-ipEndpoint IPv4 address with a CIDR notation. Refer to the official Scaleway documentation to learn more about IP and subnet limitations.
endpoint-spec.{index}.private-network.ipam-configAutomated configuration of your Private Network endpoint with Scaleway IPAM service. One at the most per Database Instance or Read Replica (a Database Instance and its Read Replica can have different private networks). Cannot be updated (has to be deleted and recreated)
same-zoneDefines whether to create the replica in the same availability zone as the main instance nodes or not.
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Create an endpoint for a Read Replica

Create a new endpoint for a Read Replica. Read Replicas can have at most one direct access and one Private Network endpoint.

Usage:

TerminalCode
scw rdb read-replica create-endpoint <read-replica-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
read-replica-idUUID of the Read ReplicaRequired
endpoint-spec.{index}.direct-accessDirect access endpoint specifications. Public endpoint reserved for Read Replicas. One per Read Replica
endpoint-spec.{index}.private-network.private-network-idUUID of the Private Network to be connected to the Read Replica
endpoint-spec.{index}.private-network.service-ipEndpoint IPv4 address with a CIDR notation. Refer to the official Scaleway documentation to learn more about IP and subnet limitations.
endpoint-spec.{index}.private-network.ipam-configAutomated configuration of your Private Network endpoint with Scaleway IPAM service. One at the most per Database Instance or Read Replica (a Database Instance and its Read Replica can have different private networks). Cannot be updated (has to be deleted and recreated)
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete a Read Replica

Delete a Read Replica of a Database Instance. You must specify the region and read_replica_id parameters of the Read Replica you want to delete.

Usage:

TerminalCode
scw rdb read-replica delete <read-replica-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
read-replica-idUUID of the Read ReplicaRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Get a Read Replica

Retrieve information about a Database Instance Read Replica. Full details about the Read Replica, like endpoints, status and region are returned in the response.

Usage:

TerminalCode
scw rdb read-replica get <read-replica-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
read-replica-idUUID of the Read ReplicaRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Resync a Read Replica

When you resync a Read Replica, first it is reset, then its data is resynchronized from the primary node. Your Read Replica remains unavailable during the resync process. The duration of this process is proportional to the size of your Database Instance. The configured endpoints do not change.

Usage:

TerminalCode
scw rdb read-replica reset <read-replica-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
read-replica-idUUID of the Read ReplicaRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Setting management

Advanced Database Instance settings allow you to tune the behavior of your database engines to better fit your needs.

Available settings depend on the database engine and its version. Note that some settings can only be defined upon database engine initialization. These are called init settings. You can find a full list of the settings available in the response body of the list available database engines endpoint.

Each advanced setting entry has a default value that users can override. The deletion of a setting entry will restore the setting to default value. Some of the defaults values can be different from the engine's defaults, as we optimize them to the Scaleway platform.

Add Database Instance advanced settings

Add an advanced setting to a Database Instance. You must set the name and the value of each setting.

Usage:

TerminalCode
scw rdb setting add [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance you want to add settings toRequired
settings.{index}.name
settings.{index}.value
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete Database Instance advanced settings

Delete an advanced setting in a Database Instance. You must specify the names of the settings you want to delete in the request.

Usage:

TerminalCode
scw rdb setting delete [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance to delete settings fromRequired
setting-names.{index}Settings names to deleteRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Edit Database Instance settings in your default editor

This command opens the current settings of your RDB instance in your $EDITOR. You can modify the values and save the file to apply the new configuration.

Usage:

TerminalCode
scw rdb setting edit <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idID of the instanceRequired
modemarshaling used when editing dataDefault: yaml
One of: yaml, json
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Examples:

Edit instance settings in YAML

TerminalCode
scw rdb setting edit 12345678-1234-1234-1234-123456789abc --region=fr-par --mode=yaml

Edit instance settings in JSON

TerminalCode
scw rdb setting edit 12345678-1234-1234-1234-123456789abc --region=fr-par --mode=json

Set Database Instance advanced settings

Update an advanced setting for a Database Instance. Settings added upon database engine initialization can only be defined once, and cannot, therefore, be updated.

Usage:

TerminalCode
scw rdb setting set [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance where the settings must be setRequired
settings.{index}.name
settings.{index}.value
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Block snapshot management

A snapshot is a consistent, instantaneous copy of the Block Storage volume of your Database Instance at a certain point in time. They are designed to recover your data in case of failure or accidental alterations of the data by a user. They allow you to quickly create a new Instance from a previous state of your database, regardless of the size of the volume. Their limitation is that, unlike backups, snapshots can only be stored in the same location as the original data.

Create a Database Instance snapshot

Create a new snapshot of a Database Instance. You must define the name parameter in the request.

Usage:

TerminalCode
scw rdb snapshot create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database InstanceRequired
nameName of the snapshotRequired
Default: <generated>
expires-atExpiration date (must follow the ISO 8601 format)
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete a Database Instance snapshot

Delete a given snapshot of a Database Instance. You must specify, in the endpoint, the region and snapshot_id parameters of the snapshot you want to delete.

Usage:

TerminalCode
scw rdb snapshot delete <snapshot-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
snapshot-idUUID of the snapshot to deleteRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Get a Database Instance snapshot

Retrieve information about a given snapshot, specified by its snapshot_id and region. Full details about the snapshot, like size and expiration date, are returned in the response.

Usage:

TerminalCode
scw rdb snapshot get <snapshot-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
snapshot-idUUID of the snapshotRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

List snapshots

List snapshots. You can include the instance_id or project_id in your query to get the list of snapshots for specific Database Instances and/or Projects. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw rdb snapshot list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameName of the snapshot
order-byCriteria to use when ordering snapshot listingOne of: created_at_asc, created_at_desc, name_asc, name_desc, expires_at_asc, expires_at_desc
instance-idUUID of the Database Instance
project-idProject ID the snapshots belongs to
organization-idOrganization ID the snapshots belongs to
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

Create a new Database Instance from a snapshot

Restore a snapshot. When you restore a snapshot, a new Instance is created and billed to your account. Note that is possible to select a larger node type for your new Database Instance. However, the Block volume size will be the same as the size of the restored snapshot. All Instance settings will be restored if you chose a node type with the same or more memory size than the initial Instance. Settings will be reset to the default if your node type has less memory.

Usage:

TerminalCode
scw rdb snapshot restore <snapshot-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
snapshot-idBlock snapshot of the Database InstanceRequired
instance-nameName of the Database Instance created with the snapshot
is-ha-clusterDefines whether or not High-Availability is enabled on the new Database InstanceDeprecated
high-availability-modeDefines the High-Availability mode of the instanceOne of: unknown_high_availability_mode, disabled, single_zone, multiple_zone
node-typeThe node type used to restore the snapshot
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Update a Database Instance snapshot

Update the parameters of a snapshot of a Database Instance. You can update the name and expires_at parameters.

Usage:

TerminalCode
scw rdb snapshot update <snapshot-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
snapshot-idUUID of the snapshot to updateRequired
nameName of the snapshot
expires-atExpiration date (must follow the ISO 8601 format)
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

User management commands

Users are profiles to which you can attribute database-level permissions. They allow you to define permissions specific to each type of database usage. For example, users with an admin role can create new databases and users.

Create a user for a Database Instance

Create a new user for a Database Instance. You must define the name, password and is_admin parameters.

Usage:

TerminalCode
scw rdb user create [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance in which you want to create a userRequired
nameName of the user you want to create
generate-passwordWill generate a 21 character-length password that contains a mix of upper/lower case letters, numbers and special symbolsDefault: true
passwordPassword of the user you want to create. Password must be between 8 and 128 characters, contain at least one digit, one uppercase, one lowercase and one special character
is-adminDefines whether the user will have administrative privileges
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Delete a user on a Database Instance

Delete a given user on a Database Instance. You must specify, in the endpoint, the region, instance_id and name parameters of the user you want to delete.

Usage:

TerminalCode
scw rdb user delete [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance to delete the user fromRequired
nameName of the userRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw

Gets the URL to connect to the Database

Provides the URL to connect to a Database on an Instance as the given user

Usage:

TerminalCode
scw rdb user get-url <instance-id ...> [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idID of the Database InstanceRequired
userUser of the Database
dbName of the Database to connect to

List users of a Database Instance

List all users of a given Database Instance. By default, the users returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field.

Usage:

TerminalCode
scw rdb user list [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
nameName of the user
order-byCriteria to use when requesting user listingOne of: name_asc, name_desc, is_admin_asc, is_admin_desc
instance-idUUID of the Database InstanceRequired
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw, all

Update a user on a Database Instance

Update the parameters of a user on a Database Instance. You can update the password and is_admin parameters, but you cannot change the name of the user.

Usage:

TerminalCode
scw rdb user update [arg=value ...]

Arguments:

NameDescriptionArgument Specifications
instance-idUUID of the Database Instance the user belongs toRequired
nameName of the database userRequired
generate-passwordWill generate a 21 character-length password that contains a mix of upper/lower case letters, numbers and special symbolsDefault: true
passwordPassword of the database user. Password must be between 8 and 128 characters, contain at least one digit, one uppercase, one lowercase and one special character
is-adminDefines whether or not this user got administrative privileges
regionRegion to target. If none is passed will use default region from the configDefault: fr-par
One of: fr-par, nl-ams, pl-waw