This guide explains how to create a LaminDB instance that's fully deployed in LaminHub and comes with default SQL permission roles.
Two things happen in addition to the open-source lamin init
:
- connecting the LaminHub backend to your Postgres database
- creating SQL permission roles
read
,write
, andadmin
and synching them with storage permissions
Ensure you have access to a PostgreSQL server with a default database called postgres
and a default superuser called postgres
.
Ensure that our LaminHub backend servers are whitelisted so that our servers can access your database. The IP addresses are listed here) resoled by AWS region.
You can optionally provide your S3 bucket to serve as the default storage location of a LaminDB instance.
To give Lamin access to your bucket, attach this AWS permission policy (here is how to do this manually through the AWS console).
API_URL
: The URL of the API, depending on your region, pick from hereDB_SERVER_URL
: The URL for the PostgreSQL server in the formatpostgresql://postgres:<password>@<host>:<port>/postgres
NAME
: The name of the LaminDB instance
Optionals:
SCHEMA
: The list of schemas you want to mount, e.g.,bionty,wetlab
STORAGE
: The S3 bucket URI in the formats3://my-bucket
Install lamindb_setup
via pip install lamindb_setup
in case you don't have a lamindb installation.
In your terminal, run lamin login
to ensure you're authenticated.
To create the instance, run the following python code:
import requests
from lamindb_setup import settings
API_URL = "https://us-west-2.api.lamin.ai" # Update API_URL according to the region where you to deploy.
DB_SERVER_URL = "postgresql://postgres:<PASSWORD>@<HOST>:<PORT>/postgres"
NAME = "YOUR-INSTANCE-NAME"
SCHEMA_STR = "bionty"
STORAGE = "s3://YOUR-BUCKET-NAME"
response = requests.put(
f"{API_URL}/instances?db_server_url={DB_SERVER_URL}&name={NAME}&schema_str={SCHEMA_STR}&storage={STORAGE}",
headers={"authentication": f"Bearer {settings.user.access_token}"},
)
Upon success, navigate to https://lamin.ai/handle/instance-name
, where handle
is your user handle and instance-name
the NAME
parameter above.