Skip to main content

Overview

The fjall secret command manages secrets stored in AWS SSM Parameter Store. Secrets are namespaced by application and optionally by cluster and service for fine-grained access control.
You can also use the secrets alias: fjall secrets set KEY=value --app myapp

Usage

Subcommands

set

Set a secret value:
Set a secret value from a file:
Example:

get

Retrieve a secret value:
Example:
Output is just the value, suitable for piping:

list / ls

List all secrets in a namespace:
With child namespaces:
Output:

delete / rm

Delete a secret:
Deletion is permanent. The --force flag is required in non-interactive mode.
For service-scoped secrets, also remove the key from the service’s infrastructure.ts ssmSecrets declaration — a declaration pointing at a deleted parameter breaks the next task launch:
Without the flag, an interactive delete of a service-scoped key asks whether to remove the declaration too.

export

Export secrets in dotenv format:
Output:
Values are double-quoted, with embedded quotes, backslashes, dollar signs, backticks, and newlines escaped. Save to file:

exec

Execute a command with secrets as environment variables:
This fetches all secrets in the namespace and injects them as environment variables before running the command.

import

Import secrets from a .env file:
Example:
The file path is required; omitting it produces Error: File path is required.

Options

The -f short flag has different meanings depending on the subcommand: --from-file for set and --force for delete. Use the long form to avoid ambiguity.

Namespace Hierarchy

Secrets are organised in a hierarchical namespace:
The cluster name lambda is reserved — it marks Lambda-scoped paths in the hierarchy. Use --lambda <function> for Lambda secrets; --cluster lambda is rejected.
Inheritance applies only to fjall secrets exec and fjall secrets export: these merge secrets from parent namespaces (app → cluster → service, with more specific values overriding). Deployed workloads do not inherit — an ECS service reads only its exact /<app>/<cluster>/<service>/ path, and a Lambda only /<app>/lambda/<function>/. App-level secrets are never injected into containers.

Applying Changes to Running Services

ECS tasks read secret values when they start — updating a parameter does not change what already-running tasks see.
  • Rotated an existing secret? Restart the running services so new tasks pick up the value. After a successful set or import on a terminal, the CLI offers this directly (Apply to myapp's running services now? (Y/n)); it is also available standalone:
    See fjall rollout — no build, no deploy, and the restart shows which services were running with stale values before you confirm.
  • Added a new key? Run a full deploy so the task definition gains the reference (when you pass --cluster/--service, the CLI adds the declaration to your infrastructure.ts automatically):
A plain fjall deploy after rotating an existing value is usually a no-op — unchanged code produces an unchanged image, so nothing restarts. Use fjall rollout, which always rolls the running services.

Non-Interactive Mode

For CI/CD pipelines, use the --non-interactive flag with all required options:

Secret Naming Rules

Secret names must:
  • Start with a letter or underscore
  • Contain only letters, numbers, underscores, hyphens, or periods
Valid examples:
  • DATABASE_URL
  • API_KEY_V2
  • database-url
  • my.secret
  • _internal_flag
Invalid examples:
  • 2FA_CODE (starts with a number)
  • my secret (contains a space)

Security

  • Secrets are stored encrypted in AWS SSM Parameter Store (SecureString type)
  • Access is controlled via IAM policies
  • Secrets are displayed in plain text only when you explicitly request them (get, export) or inject them into a process environment (exec); they are never written to logs
  • Use namespace hierarchy for least-privilege access

Examples

Set multiple secrets

Local development with secrets

CI/CD pipeline

Service-specific secrets

Troubleshooting

Permission Denied

Cause: IAM role doesn’t have access to the parameter. Solution: Ensure your AWS credentials have ssm:GetParameter permission for the parameter’s ARN.

Secret Not Found

Cause: Secret doesn’t exist or wrong namespace. Solution: Use fjall secrets list --app myapp to see available secrets.

Invalid Secret Name

Cause: The secret name doesn’t follow the naming rules. Solution: Start the name with a letter or underscore and use only letters, numbers, underscores, hyphens, or periods.

Next Steps

Deploy an application

Deploy your application to AWS with its secrets attached.

Connect an AWS account

Connect the AWS account that stores secrets in SSM Parameter Store.

Configure a deployment user

Grant the IAM permissions needed to read and write secrets.

Secrets Manager resource

Add an AWS Secrets Manager resource to your infrastructure.