Inject Secrets from Parameter Store

Pull values from AWS Systems Manager Parameter Store or AWS Secrets Manager into your application, using the ssm dependency engine.

The ssm dependency engine pulls parameters and secrets from your cloud
provider into a Kubernetes secret in your application's namespace. If you have
not created the secret yet, create it first in Secrets Manager in SVIEW
rather than by hand — it places the value at the right path and can generate
this configuration for you. See Secrets Manager.

Where the parameter has to live

The parameter name in the cloud provider must follow this format, matching your
application's stage, environment, namespace, and instance:

/<stage>/<tenant>/<namespace>/application-secrets-<instance>

For example, a SecureString parameter named
/dev/<your-environment>/payments/application-secrets-gw holding:

{
  "EMAIL_HOST_PASSWORD": "...",
  "SOME_SECRET_KEY": "..."
}

is read by this application configuration:

dependency:
  ssm:
    followKeysFormat: true
    instance: gw
    namespace: payments
    json: "false"
    keys:
      - EMAIL_HOST_PASSWORD
      - SOME_SECRET_KEY

Configuration reference

KeyDefaultDescription
keys[]Parameters to fetch. With json: "true" the keys are looked up inside one JSON secret; with "false" each key is a separate parameter
keys[].name—When an entry is written as an object: the environment variable name your application reads
keys[].ssmKeys—When an entry is written as an object: the parameter or parameters to fetch for that entry
followKeysFormatfalseWhen false, every key in the resulting secret is uppercased
instanceapplication nameRead another instance's parameters
namespaceapplication namespaceRead another namespace's parameters
secretNameauto-generatedName of the created Kubernetes secret — rarely needs setting
sOverride—Set to secretsmanager to read from AWS Secrets Manager instead of Parameter Store
json"false"Set to "true" when one parameter holds a JSON object and you want to pull individual keys out of it, "false" when each key is its own parameter

Each entry under keys can be a plain key name, as in the example above, or an
object with its own ssmKeys and overrides, as in the worked example below.

Worked example — your own secrets plus one shared value

A common case is an application that has its own secrets but also needs a value
that several teams share. Keep the shared value in its own parameter and
override the location for just that key:

dependency:
  ssm:
    keys:
      - EMAIL_HOST_PASSWORD
      - ssmKeys:
          - SHARED_API_KEY
        namespace: "shared"
        instance: "common"
        sOverride: secretsmanager
        json: "true"

The first entry is read from the application's own parameter using the defaults.
The second is read from a JSON secret in AWS Secrets Manager belonging to the
shared namespace and the common instance. Each override applies only to the
entry it sits under, so you do not have to move your own secrets to match.

Related articles


Did this page help you?