AWS CloudFormation pseudo parameters are incorrect locally

Viewed 310

I am working on AWS Serverless application using SAM. My template.yaml has this line for defining an S3 bucket name:

BucketName: !Sub ${AWS::StackName}-visit-attachments-${AWS::AccountID}

When I deploy to AWS using sam deploy the variables are substituted correctly. But when I execute the lambda function locally, the resulting string is local-visit-attachments-123456789012. I can't find where the local and 123456789012 are coming from since I don't have them anywhere in the configs.

How can I make it so it uses the same values locally as when I deploy to AWS?

1 Answers

sam local invoke takes --env-vars parameter. You should be able to overwrite these default values by setting AWS_REGION and AWS_ACCOUNT_ID.

Related