Create PostgreSQL database and user

Create user via stdin then DB with that owner; note: password-stdin avoids shell history leak

yc managed-postgresql user create <name> --cluster-name <name> --password-stdin && yc managed-postgresql database create <name> --cluster-name <name> --owner <name>

tool
yc32 commands
tags
yccloudsecrets

More yc commands

  • 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 via 6432 PgBouncer with YC CA; note: verify-full needs root.crt to pin the host

  • yc managed-redis cluster list --format json | jq -r '.[] | select(.health!="ALIVE") | "\(.name)\t\(.status)\t\(.health)"'

    Filter Redis clusters to unhealthy ones only for a quick fleet triage

  • yc managed-clickhouse cluster list --format json | jq -r '.[] | "\(.name)\t\(.config.version)\t\(.resources.resourcePresetId)"'

    Audit ClickHouse cluster versions and presets to spot upgrade candidates

  • yc iam access-key create --service-account-name <name> --format json | jq -r '"AWS_ACCESS_KEY_ID=\(.access_key.key_id)\nAWS_SECRET_ACCESS_KEY=\(.secret)"'

    Mint S3-compatible static key for a SA; note: secret shown once, capture it now

  • aws --endpoint-url=https://storage.yandexcloud.net s3 sync ./dist s3://<name>/<id>/ --delete --exclude '*.map'

    Sync to YC bucket via S3 API; modern: use --delete to mirror and prune stale objects

all 32 yc commands