Skip to main content

Overview

The cloudstic init command bootstraps a new Cloudstic repository by creating encryption key slots and writing the repository configuration marker. This command must be run before your first backup.
Encryption is required by default. All data is encrypted with AES-256-GCM unless you explicitly disable it with -no-encryption (not recommended).

Basic Usage

Encryption Modes

If running in an interactive terminal and no credentials are provided, you will be prompted to enter a password:
If credentials are already provided (via -encryption-key, -kms-key-arn, etc.), no password is prompted unless you explicitly pass -prompt.

Platform Key + Password (Multi-Factor)

For maximum security, combine a platform key with an interactive password. Both are required to decrypt:

Platform Key Only

With Recovery Key

Generate a 24-word BIP39 recovery phrase during initialization:
Output:
Store your recovery key in a password manager or write it down and keep it in a secure location. This is your last resort for recovering encrypted backups if you forget your password.
Output:
Only use -no-encryption for testing or when storing data that is already encrypted at rest by another system. Your backup data will be stored in plaintext.

Command Flags

boolean
default:"false"
Generate a 24-word BIP39 recovery key during initialization. The recovery phrase is displayed once and allows you to recover your repository if you lose your password or platform key.
boolean
default:"false"
Create an unencrypted repository. Not recommended unless you have a specific reason (e.g., data is pre-encrypted, testing, or compliance requirements).
boolean
default:"false"
Force an interactive password prompt even when other credentials (e.g. -encryption-key, -kms-key-arn) are already provided. Use this to add a password layer on top of a platform or KMS key.
boolean
default:"false"
Disable all interactive prompts. If no encryption credentials are provided and --no-prompt is set, init fails with an error instead of prompting for a password. Useful for scripts and CI/CD pipelines.

Global Flags (All Commands)

string
default:"local:./backup_store"
Storage backend URI. Formats: local:<path>, s3:<bucket>[/<prefix>], b2:<bucket>[/<prefix>], sftp://[user@]host[:port]/<path>.
string
default:""
Platform key as 64 hexadecimal characters (32 bytes). Used for platform-managed encryption in automated environments.
string
default:""
Repository password for password-based encryption. If not provided and no other credentials are set, and running interactively, you will be prompted.
string
default:""
AWS KMS key ARN for envelope encryption. Requires AWS credentials with KMS decrypt permissions.
string
default:""
AWS region for KMS operations. Defaults to AWS SDK’s standard discovery logic if not provided.
string
default:""
Custom endpoint URL for KMS operations (e.g., for local testing with LocalStack).
boolean
default:"false"
Log detailed operations.
boolean
default:"false"
Suppress progress output (keeps final summary).
boolean
default:"false"
Write the command result as JSON to stdout instead of the human-readable initialization summary.
boolean
default:"false"
Log every store request with network call details, timing, and sizes.

S3-Specific Flags

string
default:""
S3-compatible endpoint URL (for MinIO, Cloudflare R2, DigitalOcean Spaces, etc.).
string
default:"us-east-1"
S3 region.
string
default:""
S3 access key ID.
string
default:""
S3 secret access key.

SFTP Store Credentials

string
default:""
SFTP store password.
string
default:""
Path to SSH private key for SFTP store authentication.
string
default:""
Path to custom known_hosts file for host key validation.
boolean
default:"false"
Skip host key validation (INSECURE).

Backblaze B2 Flags

string
default:""
Backblaze B2 application key ID.
string
default:""
Backblaze B2 application key.

Examples

Local Repository with Password

S3 Repository with Recovery Key

MinIO/S3-Compatible Storage

SFTP Repository

Backblaze B2

Behavior

Encryption Key Slots

When you initialize an encrypted repository, Cloudstic:
  1. Generates a random 32-byte master key
  2. Wraps the master key with your password or platform key using strong KDF (Argon2id for passwords)
  3. Stores the encrypted key slot(s) under keys/ in the repository
  4. Derives an HMAC dedup key from the master key for content-addressing without exposing plaintext hashes

Adopting Existing Key Slots

If key slots already exist in the store (e.g., from a previous partial init or if you are adding new credentials), cloudstic init --adopt-slots will verify you can unlock them with the provided credentials and automatically create new slots for any additional credentials provided in the command line.
Output:
If credentials don’t match, init fails:

Repository Already Initialized

Running init on an already initialized repository exits immediately:

Troubleshooting

Error: encryption is required by default

Solution: Provide credentials via flags, or run interactively to be prompted for a password. If using a platform key or KMS, no password is prompted automatically. Add -prompt to explicitly request one.

Error: encryption password cannot be empty

Solution: Provide a non-empty password when prompted or via the -password flag.

Error: passwords do not match

Solution: Re-run the command and ensure both password entries are identical.

Invalid —encryption-key

Solution: The -encryption-key must be exactly 64 hexadecimal characters (0-9, a-f). Generate with: