I'm learning AWS Serverless Application Model. I'm trying the following model:
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Resources:
MyLambdaFunction:
Type: 'AWS::Serverless::Function'
Properties:
Runtime: nodejs8.10
Handler: index.handler
CodeUri:
Bucket: artifacts-for-lambda
Key: my-lambda-package.zip
Events:
MySchedule:
Type: Schedule
Properties:
Schedule: rate(1 minute)
MyS3Upload:
Type: S3
Properties:
Bucket: !Ref MyS3Bucket
Events: s3:ObjectCreated:*
MyS3Bucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: upload-something-here
This is how I'm running it:
aws cloudformation deploy
--capabilities CAPABILITY_NAMED_IAM
--template-file sam-template.yaml
--stack-name my-serverless-app
This is the error I'm receiving:
Error occurred while GetObject. S3 Error Code: PermanentRedirect. S3 Error Message: The bucket is in this region: us-east-1. Please use this region to retry the request (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException
us-east-2
is my default region per my AWS config file.
If us-east-2
is my default region why am I getting this error message saying The bucket is in this region: us-east-1
? How do I specify a region for my S3 bucket in my serverless script?