How to create a Database Lab clone
GUI​
- Go to the Database Lab instance page.
- Click the Create clone button.
- Fill the ID field with a meaningful name.
- (optional) By default, the latest data snapshot (closest to production state) will be used to provision a clone. You can select any other available snapshot.
- Fill database credentials. Remember the password, it will not be available later, but you will need to use it to connect to the clone.
- (optional) Enable protected status (it can be done later if needed). Please be careful: abandoned protected clones may cause out-of-disk-space events. Read the details here.
- Click the Create clone button and wait for a clone to provision.
- You will be redirected to the Database Lab clone page.
CLI​
Before you run any commands, install Database Lab CLI and initialize configuration. For more information, see Install and initialize Database Lab CLI.
Reference​
- Command
dblab clone create
- Command
dblab snapshot list
Basic clone creation​
Create a clone using dblab clone create
command. You need to specify the username and password that will be used to connect to the clone. Remember the password, it will not be available later, but you will need to use it to connect to the clone.
$ dblab clone create --username USERNAME --password PASSWORD --id CLONE_ID
{
"id": "CLONE_ID",
"status": {
"code": "OK",
"message": "Clone is ready to accept Postgres connections."
},
"db": {
"connStr": "host=dev2.postgres.ai port=6001 user=USERNAME dbname=postgres",
"host": "dev2.postgres.ai",
"port": "6001",
"username": "USERNAME",
"password": ""
},
...
}
Create a clone with a non-default snapshot​
By default latest data snapshot (closest to production state) will be used to provision a clone. You can select any other available snapshot.
- List available snapshots.
$ dblab snapshot list
[
{
"id": "SNAPSHOT_ID_2",
"createdAt": "2020-08-12T12:00:11Z",
"dataStateAt": "2020-08-12T11:59:24Z"
},
{
"id": "SNAPSHOT_ID_1",
"createdAt": "2020-08-12T11:00:11Z",
"dataStateAt": "2020-08-12T10:59:04Z"
},
...
]
- Create a clone with the state, based on the desired snapshot.
$ dblab clone create --username USERNAME --password PASSWORD --id CLONE_ID --snapshot-id SNAPSHOT_ID
{
"id": "CLONE_ID",
"status": {
"code": "OK",
"message": "Clone is ready to accept Postgres connections."
},
"snapshot": {
"id": "SNAPSHOT_ID",
"createdAt": "2020-08-12T12:00:11Z",
"dataStateAt": "2020-08-12T11:59:24Z"
},
...
}
Protected status​
You can make clone protected during the creation or later (if needed). Please be careful: abandoned protected clones may cause out-of-disk-space events. Read the details here.
$ dblab clone create --username USERNAME --password PASSWORD --id CLONE_ID --protected
{
"id": "democlone",
"protected": true,
"status": {
"code": "OK",
"message": "Clone is ready to accept Postgres connections."
},
...
}
Related​
- Guide: Connect to a clone
- Guide: Destroy a clone