-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
67 lines (58 loc) · 1.49 KB
/
Copy pathserverless.yml
File metadata and controls
67 lines (58 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# API S3 Bucket Creation
service: api-${file(config.json):BUCKET}
plugins:
- serverless-dotenv-plugin
provider:
environment:
# Runtime
name: aws
runtime: nodejs16.x
# Stage DEV/PROD
stage: ${file(config.json):STAGE}
# Region Paris
region: eu-west-3
# API IAM Roles allow PutObject
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObject
Resource: "arn:aws:s3:::${file(config.json):BUCKET}/*"
# Define NodeJS function to run
functions:
# We define a function called "store"
store:
# Where function with name "handle" will run
handler: api.handle
# Configure POST event
events:
- http:
path: /
method: post
cors: false
# Configure Frontend S3 Bucket
resources:
Resources:
# Frontend S3 Bucket Creation
FrontendS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: s2-isarria-dev
PublicAccessBlockConfiguration:
BlockPublicAcls: false
OwnershipControls:
Rules:
- ObjectOwnership: ObjectWriter
WebsiteConfiguration:
IndexDocument: index.html
# Frontend S3 Bucket Policy
FrontendS3BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: ${file(config.json):BUCKET}
PolicyDocument:
Statement:
- Action:
- s3:GetObject
Effect: Allow
Resource: arn:aws:s3:::${file(config.json):BUCKET}/*
Principal: "*"