- 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 the Nebius AI Cloud CLI or provider for Terraform
If you want to manage clusters and other Nebius AI Cloud resources in the command line or using Terraform, install and configure one of these tools:Create a cluster
- Web console
- CLI
- Terraform
-
In the sidebar, go to
Storage → 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.
- Unarchive the file into a folder.
-
From the folder to which you unarchived 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.