params2env reads AWS SSM Parameter Store parameters and writes them
as environment variables. Also supports create, modify, and delete.
Uses AWS Go SDK. Minimal dependencies, prefers Go standard library (slog, testing) where possible.
Config via YAML file (~/.params2env.yaml or .params2env.yaml) or
CLI args. CLI args override config. Local config takes precedence
over home directory.
Binaries for Linux, macOS, and Windows on GitHub Releases. Download and add to PATH.
Use the reusable action to install params2env in your workflows (Linux runners only):
- uses: wombelix/params2env@v0.5.0This installs the latest released version of the CLI. To pin a specific CLI version:
- uses: wombelix/params2env@v0.5.0
with:
version: 0.4.0The action version (e.g., @v0.5.0) and CLI version can differ,
allowing you to use newer action while pinning the CLI.
Or install via Go:
go install git.sr.ht/~wombelix/params2env@latestGenerate shell completion scripts for tab completion of commands and flags.
# Bash (add to ~/.bashrc)
source <(params2env completion bash)
# Zsh (add to ~/.zshrc)
source <(params2env completion zsh)
# Fish (add to ~/.config/fish/config.fish)
params2env completion fish | source
# PowerShell (add to $PROFILE)
params2env completion powershell | Out-String | Invoke-ExpressionGlobal flags:
--loglevel:debug,info,warn,error,fatal,panic(default:info)--version: Print version--help: Print help
--region: AWS region (or useAWS_REGION/AWS_PROFILEenv vars)--path: Parameter path (required)--role: IAM role ARN to assume--file: Output file (default: stdout)--format: Output format:envorgithub-env(default:env)--upper: Uppercase env var names (default:true)--env-prefix: Prefix for env var names--env: Custom env var name (overrides auto-generated name)
Environment variable naming:
By default, the env var name is the last segment of the parameter path.
With --upper (enabled by default), it gets uppercased.
| Parameter Path | --env-prefix |
--upper |
Result |
|---|---|---|---|
/app/db_password |
- | true | DB_PASSWORD |
/app/db_password |
APP |
true | APP_DB_PASSWORD |
/app/db_password |
- | false | db_password |
Use --env to set a fully custom name when auto-generation doesn't fit.
Output formats:
env(default):export KEY="value"- for shell sourcinggithub-env:KEY=value- for GitHub Actions with automatic masking
GitHub Actions usage:
The github-env format automatically:
- Outputs masking commands (
::add-mask::value) to stdout - Append
KEY=valueformat to$GITHUB_ENVfile
# GitHub Actions workflow
- name: Load secrets
run: |
params2env read --path "/app/db-password" --format github-env
# Automatically writes to $GITHUB_ENV and masks the value
# Manual file specification
params2env read --path "/app/secret" --format github-env --file secrets.envExample:
params2env read --region "eu-central-1" --path "/my/secret" \
--role "arn:aws:iam::111122223333:role/my-role" \
--file "~/.my-secret" --upper "false" \
--env-prefix "my_" --env "secret"
# GitHub Actions format
params2env read --path "/app/db-password" --format github-env
# Traditional shell format
params2env read --path "/app/config" --format envResult in ~/.my-secret:
export my_secret="<secret-value>"To set env vars in your shell:
# Using eval
eval $(params2env read --path "/my/secret")
# Using source
source <(params2env read --path "/my/secret")--region: AWS region (or useAWS_REGIONenv var)--replica: Replica region--path: Parameter path (required)--description: Parameter description--value: Parameter value (optional, see below)--type:StringorSecureString(default:String)--kms: KMS Key ID for SecureString (e.g.,alias/aws/ssmoralias/myapp-key)--role: IAM role ARN to assume--overwrite: Overwrite existing (default:false)
Value input methods (in order of precedence):
--valueflag- Piped stdin (e.g.,
echo "secret" | params2env create ...) - Interactive prompt (SecureString: hidden, String: visible)
Example:
params2env create --region "eu-central-1" --replica "eu-west-1" \
--path "/my/secret" \
--description "Secret stored as SecureString" \
--value "S3cr3t" --type "SecureString" \
--kms "alias/myapp-key" \
--role "arn:aws:iam::111122223333:role/my-role"
# Pipe value to avoid shell history
echo "S3cr3t" | params2env create --path "/my/secret" \
--type "SecureString" --kms "alias/myapp-key"
# AWS managed key
params2env create --path "/my/secret" --type "SecureString" --kms "alias/aws/ssm"
# Interactive (prompts for value, hidden for SecureString)
params2env create --path "/my/secret" --type "SecureString" --kms "alias/myapp-key"--region: AWS region (or useAWS_REGIONenv var)--replica: Replica region--path: Parameter path (required)--description: Parameter description--value: New value (optional, see below)--role: IAM role ARN to assume
Value input methods (in order of precedence):
--valueflag- Piped stdin (e.g.,
echo "newvalue" | params2env modify ...) - Interactive prompt
Example:
params2env modify --region "eu-central-1" --replica "eu-west-1" \
--path "/my/secret" \
--description "Secret stored as SecureString" \
--value "S3cr3t" \
--role "arn:aws:iam::111122223333:role/my-role"
# Pipe value
echo "NewValue" | params2env modify --path "/my/secret"
# Interactive
params2env modify --path "/my/secret"--region: AWS region (or useAWS_REGIONenv var)--replica: Replica region to delete from--path: Parameter path (required)--role: IAM role ARN to assume
Example:
params2env delete --region "eu-central-1" --replica "eu-west-1" \
--path "/my/secret" \
--role "arn:aws:iam::111122223333:role/my-role"Config file locations (local overrides global):
- Global:
~/.params2env.yaml - Local:
.params2env.yaml
region: <aws region>
replica: <replica region>
prefix: <search path prefix>
file: <output file>
format: <output format: env or github-env>
upper: <uppercase env names, default true>
env_prefix: <env var prefix>
role: <iam role to assume>
kms: <kms key for SecureString>
params:
- name: <param path>
env: <custom env var name>
region: <region override>
output: <output format override>| Config Field | create |
modify |
delete |
read |
|---|---|---|---|---|
region |
✓ | ✓ | ✓ | ✓ |
replica |
✓ | ✓ | ✓ | - |
role |
✓ | ✓ | ✓ | ✓ |
kms |
✓ | - | - | - |
format |
- | - | - | ✓ |
env_prefix |
- | - | - | ✓ |
file |
- | - | - | ✓ |
upper |
- | - | - | ✓ |
params |
- | - | - | ✓ |
Notes:
kmsis only needed forcreatewith SecureString. Modify/delete don't change encryption.replicakeeps parameters in sync across regions during write operations.readfetches from one region only. Use per-paramregionoverride for multi-region reads.
Without config, creating a SecureString requires many flags:
params2env create --path /app/secret --value "s3cr3t" --type SecureString \
--region eu-central-1 --replica eu-west-1 \
--role arn:aws:iam::123456789012:role/my-role --kms alias/my-keyWith this config file:
region: eu-central-1
replica: eu-west-1
role: arn:aws:iam::123456789012:role/my-role
kms: alias/my-keyCommands simplify to:
params2env create --path /app/secret --value "s3cr3t" --type SecureString
params2env create --path /app/secret --type SecureString # prompts for value
params2env modify --path /app/secret --value "new-value"
params2env modify --path /app/secret # prompts for value
params2env delete --path /app/secretregion: eu-central-1
role: arn:aws:iam::123456789012:role/my-role
env_prefix: APP
format: github-env
upper: true
params:
- name: /app/db_password # → APP_DB_PASSWORD (auto)
- name: /app/api_token # → APP_API_TOKEN (auto)
- name: /legacy/weird-name.v2
env: LEGACY_KEY # → LEGACY_KEY (override)
- name: /other/endpoint
region: us-east-1 # → APP_ENDPOINT (different region)params2env read # Read all from config (github-env format)
params2env read --file ~/.env # Write to file (github-env format)
params2env read --format env # Override to traditional shell format
params2env read --path /custom/param # Single param (ignores params list)make build # Build binary
make tests # Run tests with coverage
make clean # Remove binary and coverage filestests/integration-tests.sh tests against real AWS.
export AWS_ACCOUNT_ID="123456789012"
export PRIMARY_REGION="eu-central-1"
export SECONDARY_REGION="eu-west-1"
export AWS_IAM_PRINCIPAL="arn:aws:iam::123456789012:role/YourRole"
# Optional: use existing KMS keys instead of creating new ones
export PRIMARY_KEY_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
export REPLICA_KEY_ID="yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
./tests/integration-tests.shCreates IAM roles/policies, tests all param types, cleans up after.
KMS tests cost $1/month per key - script asks before creating.
Set PRIMARY_KEY_ID and REPLICA_KEY_ID to use existing keys.
Primary: git.sr.ht/~wombelix/params2env
Mirrors: Codeberg, Gitlab, GitHub
Please don't hesitate to provide feedback, open an issue, or create a Pull / Merge Request.
Just pick the workflow or platform you prefer and are most comfortable with.
Feedback, bug reports, or patches sent to my sr.ht list ~wombelix/inbox@lists.sr.ht or via Email and Instant Messaging are also always welcome.
Unless otherwise stated: Apache 2.0
All files contain license information either as a
header comment or a corresponding .license file.
REUSE from the FSFE is implemented to verify license and copyright compliance.