# Serverless container yaml not extracting ssm variables

**URL:** <https://forum.serverless.com/t/serverless-container-yaml-not-extracting-ssm-variables/20994>\
**Category:** Serverless Framework\
**Tags:** variables\
**Created:** [February 13, 2025, 9:00pm UTC](https://forum.serverless.com/t/serverless-container-yaml-not-extracting-ssm-variables/20994 "2025-02-13T21:00:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtryearlybird](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jtryearlybird](https://forum.serverless.com/u/jtryearlybird)\
**Post date:** [February 13, 2025, 9:00pm UTC](https://forum.serverless.com/t/serverless-container-yaml-not-extracting-ssm-variables/20994/1 "2025-02-13T21:00:21Z")

</div>

I am trying to get secret from secret manager. The current documentation for env vars for the serverless container config shows to do the following which doesn’t make sense.

```auto
DATABASE_ARN: ${env:DATABASE_ARN} # Example, using Serverless Framework Variables to resolve a value from AWS Secrets Manager.  
DATABASE_URL: ${aws:ssm:/path/to/param} # Example, using Serverless Framework Variables to resolve a value from AWS Systems Manager Parameter Store.

```

Now I have a secret stored where it is a key value store the key is just “key” and I want the env var to be the stored string.

If I don’t try to reference with “.key” I get an object which throws an error

```auto
 - containers.service.environment.API_KEY : Expected string, received object 
 Input:
    API_KEY : ${aws:ssm:/aws/reference/secretsmanager/api-key}

```

If I try to use “.key” there is no value found

```auto
variable at 'containers.service.environment.API_KEY'. No value is available for this variable, and no default value was provided.
Input
    API_KEY : ${aws:ssm:/aws/reference/secretsmanager/api-key.key}

```

With lambdas I have done the following to get this to work. I relied on the custom resolver which doesn’t exist for containers.

Below is what works for me in lambda

```auto
environment:
   API_KEY: ${self:custom.api_key.key}
custom:
  api_key: ${ssm:/aws/reference/secretsmanager/api-key}

```

Is there a way to do this for container yamls?

---

<div class="post-metadata">

**Author:** ![nbcch](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/nbcch/32/7422_2.png) [@nbcch](https://forum.serverless.com/u/nbcch)\
**Post date:** [February 19, 2025, 4:31am UTC](https://forum.serverless.com/t/serverless-container-yaml-not-extracting-ssm-variables/20994/2 "2025-02-19T04:31:05Z")

</div>

`${aws:ssm...` is not correct. Try `${ssm:/...}`

Reference: [Serverless Framework - Variables - AWS SSM & Secrets Manager](https://www.serverless.com/framework/docs/guides/variables/aws/ssm#classic-pre-resolvers-format)
