Env files and AWS
List the keys a project needs in a file with no values, run commands with all of them, and use one-hour AWS sessions.
A project often needs a dozen keys at once. Name them in a file that holds no values, commit the file, and run commands through laze vault env.
The manifest
# .env.dev.vault
STRIPE_API_KEY={{vault:stripe-readonly}}
POSTHOG_API_KEY
aws-dev
NODE_ENV=development| Line | What it gives |
|---|---|
KEY={{vault:name}} | That key's value under this name |
KEY | The vault field called KEY |
connection-name | Every field of that key |
KEY=value | A plain setting, as it is written |
# ... | A comment |
laze vault env --env dev --reason "Run the app locally for the checkout fix" -- pnpm dev--env dev reads .env.dev.vault, looked for in this folder and then upwards, so one file at the root serves every worktree. Without it the file is .env.vault. A manifest can hold up to 100 keys.
All keys go on one card. The reason can come from LAZE_VAULT_REASON in a hook.
See what it resolves to
laze vault env --env dev --namesIt prints each line with the key it finds and its level, and no values. Use it when a name is missing.
In a shell
laze vault env --shell prints export lines for a hook that evaluates them, and refuses to print to a terminal. Prefer -- <command>: the keys then live as long as the command.
On a Laze computer
A hosted agent running laze vault env gets a placeholder for every key that can have one, and the real keys go in on the network. Keys with Used on the computer only come as values. See Sites a key is sent to.
AWS
Save an AWS access key, with a role to assume if you use one. The long-lived key never leaves the vault: a use gives a session from STS that ends after an hour.
laze vault aws aws-dev --reason "List the staging buckets" -- aws s3 lsOr as a credential process, so every AWS tool on the machine asks by itself:
# ~/.aws/config
[profile dev]
credential_process = laze vault aws aws-dev --reason "Work on the staging stack"A session is reused until 15 minutes before its end, so a long script does not ask for each call. The command gets AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_REGION and AWS_CREDENTIAL_EXPIRATION. If STS refuses, the error is vault_aws_refused with its own message.
To save one, send the bundle on standard input:
laze vault add aws-dev --label "AWS, staging" --level auto <<'JSON'
{"kind":"aws","accessKeyId":"AKIA...","secretAccessKey":"...",
"roleArn":"arn:aws:iam::123456789012:role/agents","region":"eu-west-1"}
JSONOpenClaw
laze vault exec-provider speaks OpenClaw's exec secret provider: references on standard input, values as JSON. Use it as the provider's command, and OpenClaw's config holds names only.
Exit codes
| Code | Meaning |
|---|---|
| 2 | No reason, or not one plain sentence |
| 75 | Still waiting, or the vault is busy |
| 77 | Denied |
| 1 | A key could not be found or another error |
Also check: Use your keys from Claude Code and Codex, Vault CLI.