Configuration | Christopher Diehl

August 17, 2018

Dynamically passing in ENV vars to Lambda functions created by Cloudformation

Background I’m going to assume you have experience with Lambda, AWS-SAM, and Cloudformation. To start with you should already have a template.yml for Cloudformation that looks alot like this: --- AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: AWS template Resources: ApiGatewayApi: Type: AWS::Serverless::Api Properties: StageName: Prod # Allows www.example.com to call these APIs # SAM will automatically add AllowMethods with a list of methods for this API Cors: "'www.example.com'" DefinitionBody: 'Fn::Transform': Name: 'AWS::Include' # Replace <bucket> with your bucket name Parameters: Location: s3://<bucket>/swagger. Read more