Create a managed PostgreSQL 16 cluster
Create a PG16 cluster with one host (add more --host flags for HA); for production, use an s3 preset, not a burstable b-class one.
yc managed-postgresql cluster create --name <name> --environment production --postgresql-version 16 --network-name <name> --host zone-id=ru-central1-a,subnet-name=<name> --resource-preset s3-c2-m8 --disk-size 50 --disk-type network-ssd
- tool
- yc32 commands
More yc commands
-
yc managed-postgresql cluster list-hosts --cluster-name <name> --format json | jq -r '.[] | "\(.name)\t\(.role)\t\(.health)"'Show host FQDNs with their MASTER/REPLICA role and health to know where to connect.
-
yc managed-postgresql user create <name> --cluster-name <name> --password-stdin && yc managed-postgresql database create <name> --cluster-name <name> --owner <name>Create a user with the password from stdin, then a database owned by that user; --password-stdin keeps the password out of shell history.
-
curl -s https://storage.yandexcloud.net/cloud-certs/CA.pem -o ~/.postgresql/root.crt && psql "host=<host> port=6432 sslmode=verify-full dbname=<name> user=<name> target_session_attrs=read-write"Connect through PgBouncer on port 6432 with the Yandex Cloud CA; verify-full uses root.crt to check the certificate and host name.
-
yc managed-redis cluster list --format json | jq -r '.[] | select(.health!="ALIVE") | "\(.name)\t\(.status)\t\(.health)"'Show only Redis clusters that are not ALIVE, for a quick health check.
-
yc managed-clickhouse cluster list --format json | jq -r '.[] | "\(.name)\t\(.config.version)\t\(.resources.resourcePresetId)"'Check ClickHouse versions and presets to find clusters that need an upgrade.