forked from switch120/serverless-btb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
92 lines (84 loc) · 2.13 KB
/
serverless.yml
File metadata and controls
92 lines (84 loc) · 2.13 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
# docs.serverless.com
#
# Happy Coding!
service: btb-api
plugins:
- serverless-s3-sync
- serverless-dotenv-plugin
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
region: us-east-1
# iamRoleStatements:
# - Effect: Allow
# Action:
# - s3:*
# Resource: { "Fn::Join": ["", ["arn:aws:s3:::${self:custom.siteName}", "*" ] ] }
custom:
dotenv:
include:
- SENDGRID_API_KEY
siteName: "btbmartialarts.com"
s3Sync:
- bucketName: ${self:custom.siteName}
localDir: dist/btb
serverless-offline:
host: 0.0.0.0 # localhost will not work in Vagrant, so bind to 0.0.0.0
port: 3000 # default
package:
exclude:
- node_modules/**
- src/**
- dist/**
- .vagrant
# environment:
# variable1: value1
functions:
formMailer:
handler: api/handler.mailer
events:
- http:
path: api/form/mail
method: post
cors: true
resources:
Resources:
StaticSite:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
BucketName: ${self:custom.siteName}
WebsiteConfiguration:
IndexDocument: index.html
CorsConfiguration:
CorsRules:
- AllowedOrigins:
- "*.${self:custom.siteName}"
AllowedHeaders:
- '*'
AllowedMethods:
- GET
MaxAge: 3000
StaticSiteAllowPublicReadPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: StaticSite
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "s3:*"
Resource: "arn:aws:s3:::${self:custom.siteName}/*"
Principal: "*"