- Install and configure CLIs to work with Managed Service for PostgreSQL
- Create your first cluster
- Connect to the cluster
- Perform basic operations with a PostgreSQL database
Prepare your environment
Before moving on with this guide, make sure you have thepostgresql package installed. You will need it to connect to your cluster and test a database within it.
Install postgresql package
- macOS
- Ubuntu
- Ensure you have Homebrew installed.
-
Run the command to install PostgreSQL CLI:
(Optional) Install a Nebius developer tool
To manage clusters and other Nebius AI Cloud resources from the command line, with Terraform, or with an SDK, install and configure the corresponding Nebius developer tool:- Nebius AI Cloud CLI
- Nebius AI Cloud provider for Terraform
- Nebius SDK for Go
- Nebius SDK for Python
- Nebius SDK for JavaScript
Create a cluster
- Web console
- CLI
- Terraform
- Go SDK
- Python SDK
- JavaScript SDK
- In the sidebar, go to PostgreSQL.
- Click Create cluster.
-
On the page that opens:
- Specify the Name for your cluster. Do not use spaces in cluster names.
- Write a short Description of your cluster. For example, .
- In the Username field, type the username.
-
In the Password field, come up with a secure password. Such a password must contain at least:
- 8 characters
- One lowercase character
- One uppercase character
- One special character
- Keep all the other settings with their default values — they will be more than enough for the purposes of this guide.
- Click Create cluster.
Provisioning status.Please wait until its status changes to Running before trying to perform any operations on your new cluster.Connect to your cluster
- Open your cluster’s page.
- Under the cluster name, click How to connect.
- Follow the instructions in the dialog window.
-
To check the connection, list all the databases on your cluster with the command:
You should see the following output:
Output
Perform operations with a test database
In this guide, we’ll use thedellstore2 dataset. It contains a fictional store database with products, orders, inventory, and customer information.
- Download the dellstore2-normal-1.0.tar.gz file from the PostgreSQL website.
- Extract the file into a folder.
-
From the folder to which you extracted the file, connect to your Managed Service for PostgreSQL cluster with the Nebius AI Cloud CLI and create a database on your cluster:
-
Upload the dataset from the file onto your cluster:
-
Check if the objects were created successfully:
You should see the following output:
Output
-
Write a row into the
productstable: -
Query the database to see that your row was written correctly:
You should get the following output:
Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.