I wrote a serverless.yml where I create 3 S3 bucket resources. This is some take home project I have to complete and it requires two buckets for static templates I have to process and one bucket for the results. I am defining SQS and it successfully created the queue and I was able to send messages to it from my lambda and receive messages by another lambda.
However, defining S3 bucket resources gives me An error occurred: S3LanguageTemplatesBucket - Bucket name should not contain uppercase characters.
I tried to use hard-coded values for bucket names but it didn't help.
The content of my serverless.yml file as follows:
service: process-scores
org: osano
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs12.x
profile: serverless-admin
region: us-east-1
environment:
SQS_URL: MyQueue
S3_HTML_TEMPLATES: ${self:service}-html-templates-sf68N5umh8gC8yM4
S3_LANGUAGE_TEMPLATES: ${self:service}-language-templates-gY9b7REadVPtKChV
S3_STATIC_WEBSITE: '${self:service}-static-website-pD4c7M2297pjAmST'
functions:
send:
handler: scores/producer.send
events:
- http:
path: scores
method: post
integration: lambda
cors: true
iamRoleStatements:
- Effect: Allow
Action:
- "sqs:SendMessage"
- "sqs:GetQueueUrl"
Resource:
Fn::GetAtt: [ MyQueue, Arn ]
receive:
handler: scores/consumer.receive
events:
- sqs:
arn:
Fn::GetAtt:
- MyQueue
- Arn
iamRoleStatements:
- Effect: Allow
Action:
- "s3:GetObject"
Resource:
- 'arn:aws:s3:::${self:provider.environment.S3_HTML_TEMPLATES}/*'
- 'arn:aws:s3:::${self:provider.environment.S3_LANGUAGE_TEMPLATES}/*'
- Effect: Allow
Action:
- "s3:PutObject"
Resource:
- 'arn:aws:s3:::${self:provider.environment.S3_STATIC_WEBSITE}/*'
resources:
Resources:
MyQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "MyQueue"
S3HTMLTemplatesBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: '${self:provider.environment.S3_HTML_TEMPLATES}'
S3LanguageTemplatesBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: '${self:provider.environment.S3_LANGUAGE_TEMPLATES}'
S3StaticWebsiteBucket:
Type: "AWS::S3::Bucket"
Properties:
BucketName: '${self:provider.environment.S3_STATIC_WEBSITE}'
I don't know if it can help but I also provided below the links to cloudformation templates that were generated: