CLI reference/Rotation, leases and syncs/lease
clavis lease setup
Set up a PostgreSQL, MySQL, or AWS STS credential source
sh
clavis lease setup [flags]Also available as config-create.
Set up a credential source: a Postgres or MySQL server and the grant to apply, or an AWS role to assume. Prints the config ID that lease create and lease run take. (Formerly lease config-create, which still works.)
Examples
Postgres
sh
clavis lease setup --host db.internal --database app \
--username clavis_admin --password "$PGPASSWORD" \
--grant-role app_readwrite --default-ttl 3600 --max-ttl 86400MySQL or MariaDB
sh
clavis lease setup --engine mysql --host db.internal --port 3306 \
--database app --username clavis_admin --password "$MYSQL_PASSWORD" \
--grant-privileges "SELECT, INSERT, UPDATE" --default-ttl 3600AWS STS
sh
clavis lease setup --engine aws --aws-region eu-central-1 \
--aws-access-key "$AWS_ACCESS_KEY_ID" --aws-secret-key "$AWS_SECRET_ACCESS_KEY" \
--aws-role-arn arn:aws:iam::123456789012:role/deployFlags
--aws-access-key string- AWS access key ID
--aws-external-id string- STS external ID
--aws-region string- AWS region Default:
us-east-1 --aws-role-arn string- role ARN to assume
--aws-secret-key string- AWS secret access key
--aws-session-name string- STS session name
--database string- database name
--default-ttl int- default lease TTL in seconds Default:
3600 --engine string- dynamic engine (postgres, mysql, mariadb, aws) Default:
postgres --grant-privileges string- MySQL privileges granted on the database Default:
SELECT --grant-role string- role granted to generated users
--host string- database host Default:
localhost --max-ttl int- maximum lease TTL in seconds Default:
86400 --password string- admin password
--port int- database port (3306 for MySQL) Default:
5432 --sslmode string- PostgreSQL sslmode Default:
disable --tls string- MySQL TLS: false, true, skip-verify, or preferred
--username string- admin username
Details
AWS leases return access_key_id, secret_access_key, session_token and expiration; STS credentials can't be renewed, so create a new lease. MySQL users have no database-side expiry: Clavis drops them when the lease is revoked or when the expiry job runs.
Global flags
These work with every command.
--debug- enable debug logging
--env string- environment slug
--json- output machine-readable JSON
--org string- organization slug
--overlay string- tenant/region overlay slug
--path string- folder path (default /)
--project string- project slug
--server string- Clavis server URL (default: from .clavis.yaml or saved login)
-h, --help- help for any command