0

I am working on a set of API's using the SAM framework and was wondering if there is a way to specify additional values in template.yaml that I could retrieve in my lambda handler?

Ideally, I would have something like this in template.yaml:

PostExperiment:
     Type: Api
     Properties:
         Path: /my-path
         Method: post
         Metadata:
           value1: "software"

And then in my lambda handler, I could access it something like:

export async function lambdaHandler(event, context) {
   // get `value1` from `event` or `context` somehow
}
John Grayson
  • 1,378
  • 3
  • 17
  • 30

1 Answers1

0

You can set Environment Variables that can be retrieved like any other env variable depending on your language ( os.env in python for instance )

See this aws-sam-local environment variables

lynkfox
  • 2,003
  • 1
  • 8
  • 16