For the complete documentation index, see llms.txt. This page is also available as Markdown.

Sync Command

Synchronizes selected keys from Keeper Vault to an external secrets manager

Sync is one-way. The CLI reads from Keeper Vault and writes to the external secrets manager.

sync command

Description: Sync secrets from Keeper Vault to an external secrets manager.

ksm sync --credentials <UID> --type [aws|azure|gcp|json] [--dry-run] [--preserve-missing] --map <KEY NOTATION>...

Requires a Secrets Manager profile that has been initialized with: ksm profile init <TOKEN> See the Profile Documentation.

Sync dependencies: Each non-JSON target requires Python packages. The CLI does not install these packages by default. If you installed the CLI with pip, install the packages for the target you sync to:

  • AWS (--type aws) — pip3 install 'keeper-secrets-manager-cli[aws]'

  • Azure (--type azure) — pip3 install azure-identity azure-keyvault-secrets

  • GCP (--type gcp) — pip3 install --upgrade google-cloud-secret-manager google-auth

If you installed the CLI from a downloaded installer (macOS, Windows, or Linux package), pip install has no effect on that installation. Re-run the installer and enable the "Cloud Sync" component instead.

The --type json option does not require any extra dependencies.

parameters:

  • -t, --type Type of the target key/value storage. Available types are:

    • aws - AWS Secrets Manager

    • azure- Azure Key Vault

    • gcp - GCP Secret Manager

    • json - lists all pending sync operations including both source and destination values

  • -m, --map <KEY NOTATION> Map a destination key name to a Keeper notation URI.

  • -c, --credentials <uid> UID of the Keeper record that contains credentials for the destination storage. Share this record with the Keeper Secrets Manager Application.

optional parameters:

  • -n, --dry-run Run without making changes. The output shows whether each destination secret exists and whether its value would change (dstExists, dstDiffers). The output does not include live destination values.

  • -p, --preserve-missing Preserve the destination value when the source secret is deleted.

AWS-Specific Options

  • -r, --record <RECORD> Sync individual records by UID or title. Specify this option more than once to sync multiple records. If the CLI resolves a name by title instead of UID, it prints a warning to stderr. Titles can change. Use UIDs for scheduled syncs.

  • -f, --folder <FOLDER> Sync all records from a folder, non-recursive. If the CLI resolves a name by path or folder name instead of UID, it prints a warning to stderr. Folder names can change. Use UIDs for scheduled syncs.

  • -fr, --folder-recursive <FOLDER> Sync all records from a folder and all subfolders recursively. If the CLI resolves a name by path or folder name instead of UID, it prints a warning to stderr. Folder names can change. Use UIDs for scheduled syncs.

  • -px, --prefix <PREFIX> Prefix added to every AWS secret name that the CLI derives from a record title. This option is required when you use --record, --folder, or --folder-recursive. The prefix must end in a separator character that is not a letter or digit (for example keeper/ or myapp-). The CLI rejects a prefix that does not end this way.

  • -rj, --raw-json Store the full JSON payload in the AWS secret. The format matches the output of secret get <UID> --json.

See the AWS Secrets Manager Sync documentation for detailed examples.

Automation with Crontab

Use cron to run ksm sync on a schedule.

Example 1: Simple Daily Sync

Sync once per day at 2 AM:

Example 2: Multi-Sync Shell Script

To run multiple sync operations with different mappings, create a shell script:

Create /home/user/scripts/ksm-sync-all.sh:

Make the script executable:

Add to crontab to run every 6 hours:

Sync Types

Select a provider to see the integration documentation.

AWS Secrets Manager SyncAzure Key Vault SyncGoogle Cloud Secret Manager Sync

Last updated