UniteLabs
Data

How to connect to data using command line tools

This guide shows you how to connect to your data using command line tools

ℹ️ This is one of many methods to work with lab data using UniteLabs' tooling.
   Feel free to explore the others as well!

UniteLabs database and blob storage using command line tools

You will learn:

  • How to configure AWS CLI for blob storage access
  • How to connect to the PostgreSQL database
  • How to perform basic operations on both services

Prerequisites

To follow this guide, you need:

  1. Access Credentials
  • Database credentials (username, password)
  • Blob storage credentials (access key, secret key)
  1. Required Tools
  • PostgreSQL client (psql)
  • AWS CLI (aws)

You can verify if these tools are installed by running:

psql --version
aws --version

If you need to install them:

# Install PostgreSQL client
brew install postgresql  # macOS
sudo apt-get install postgresql-client  # Ubuntu

# Install AWS CLI
pip install awscli

Authentication Setup

Configure AWS CLI for Blob Storage

  1. Create a configuration file for AWS CLI:
mkdir -p ~/.aws
  1. Create or edit the credentials file:
nano ~/.aws/credentials
  1. Add your blob storage credentials:
[default]
aws_access_key_id=YOUR_ACCESS_KEY
aws_secret_access_key=YOUR_SECRET_KEY
  1. Create or edit the configuration file:
nano ~/.aws/config
  1. Add the UniteLabs endpoint configuration:
[default]
output=json
endpoint_url=https://data.unitelabs.io:9000

Database Access

Connect to the UniteLabs PostgreSQL database using:

psql -h data.unitelabs.io -p 5432 -U postgres

You will be prompted for your database password. Once connected, you can:

  • List databases: \l
  • List tables: \dt
  • Run queries: SELECT * FROM table_name LIMIT 10;
  • Exit: \q

Blob Storage Access

Access the blob storage using AWS CLI:

# List all buckets
aws s3 ls

# List contents of a bucket
aws s3 ls s3://your-bucket-name/

# Upload a file
aws s3 cp local-file.txt s3://your-bucket-name/

# Download a file
aws s3 cp s3://your-bucket-name/remote-file.txt local-file.txt

# List bucket contents with size and modification time
aws s3 ls s3://your-bucket-name/ --recursive

Copyright © 2025