Skip to content

Creating & Viewing Secrets

Setting Secrets

keep set creates or updates secrets in your vaults.

Command Reference: keep set

OptionTypeDefaultDescription
--stagestringinteractiveTarget stage (local, staging, production)
--vaultstringdefault vaultVault to store the secret in
--securebooleantrueWhether to encrypt the secret (always true for AWS vaults)
--forcebooleanfalseOverwrite existing secrets without confirmation

Arguments:

  • [key] - Secret key name (prompted if not provided)
  • [value] - Secret value (prompted if not provided)

Examples:

bash
# Interactive mode
keep set

# Basic usage
keep set DB_PASSWORD "my-secret" --stage=local

# Force overwrite
keep set API_KEY "new-value" --stage=production --force

# Specific vault
keep set STRIPE_KEY "sk_live_..." --stage=production --vault=secretsmanager

Getting Secrets

keep get retrieves a specific secret from a vault.

Command Reference: keep get

OptionTypeDefaultDescription
--stagestringinteractiveSource stage to retrieve from
--vaultstringdefault vaultVault to retrieve the secret from
--formatstringtableOutput format: table, json, raw

Arguments:

  • [key] - Secret key name (prompted if not provided)

Examples:

bash
# Interactive mode
keep get

# Basic retrieval
keep get API_KEY --stage=local

# JSON output
keep get STRIPE_KEY --stage=production --format=json

# Raw format from specific vault
keep get CONFIG_JSON --stage=staging --vault=ssm --format=raw

Listing Secrets

keep show shows all secrets from a vault and stage.

Command Reference: keep show

OptionTypeDefaultDescription
--stagestringinteractiveStage to list secrets from
--vaultstringdefault vaultVault to list secrets from
--unmaskbooleanfalseShow actual secret values instead of masked
--formatstringtableOutput format: table, json, env
--onlystringComma-separated list of keys to include
--exceptstringComma-separated list of keys to exclude

Examples:

bash
# Basic listing
keep show --stage=local

# Show actual values
keep show --stage=production --unmask

# Filter keys
keep show --stage=production --only="API_*,MAIL_*"
keep show --stage=local --except="DB_*,STRIPE_*"

# Different formats
keep show --stage=staging --format=json
keep show --stage=production --vault=secretsmanager --format=env

Deleting Secrets

keep delete removes secrets from vaults.

Command Reference: keep delete

OptionTypeDefaultDescription
--stagestringinteractiveStage to delete secret from
--vaultstringdefault vaultVault to delete the secret from
--forcebooleanfalseDelete without confirmation prompt

Arguments:

  • [key] - Secret key name (prompted if not provided)

Examples:

bash
# Interactive mode
keep delete

# Basic deletion
keep delete OLD_CONFIG --stage=local

# Force deletion
keep delete TEMP_KEY --stage=staging --force

# Specific vault
keep delete LEGACY_SECRET --stage=production --vault=ssm

Best Practices

Naming Conventions

  • Use UPPER_CASE with underscores
  • Include purpose: DB_PASSWORD, API_KEY, STRIPE_SECRET
  • Stick to letters, numbers, underscores, and hyphens

Security

  • Never log unmasked values
  • Use --unmask sparingly
  • Verify stage before production changes
  • Be careful with --force

Common Workflows

bash
# Local development workflow
keep set DB_PASSWORD "dev-password" --stage=local
keep export --stage=local --file=.env.local
keep show --stage=local

# Production workflow (be careful!)
keep show --stage=production  # Verify stage first
keep set DB_PASSWORD "prod-password" --stage=production
keep export --stage=production --file=.env.production

Released under the MIT License.