I am trying to configure a Lambda function's S3 policy bucket that is environment specific. I would like to be able to pass a variable during either "sam package" or "sam deploy" specifying "dev", "test" or "prod". The variable would be used in the template.yaml file to select environment specific settings:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
image-processing
Resources:
ImageProcessingFunction:
Type: AWS::Serverless::Function
Properties:
Handler: src/handlers/image-processing.handler
Runtime: nodejs12.x
CodeUri: .
MemorySize: 256
Timeout: 300
Policies:
S3CrudPolicy:
BucketName: dev-bucket-name <-- change this to dev, test or prod
How can I achieve this using Parameters and or Variables? Thank you.