-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
113 lines (109 loc) · 3.69 KB
/
serverless.yml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Welcome to serverless. Read the docs
# https://serverless.com/framework/docs/
# Serverless.yml is the configuration the CLI
# uses to deploy your code to your provider of choice
# The `service` block is the name of the service
service: ${self:custom.appconfig.stackName}
plugins:
- serverless-offline
- serverless-domain-manager
package:
individually: false
excludeDevDependencies: true
include:
- config/
- dist/
- node_modules/
exclude:
- node_modules/aws-sdk/**
custom:
file: ${file(./config/serverlessconfig.json)}
appconfig: ${file(./config/appconfig.json)}
custom:
serverless-offline:
resourceRoutes: true
useChildProcesses: true
webpack:
includeModules: true
packager: "npm"
region: ${self:custom.file.awsRegion, 'eu-central-1'}
customDomain:
domainName: "sample-posts.coderockr.com"
basePath: ""
stage: ${self:provider.stage}
certificateName: "*.coderockr.com"
createRoute53Record: true
provider:
stage: ${self:custom.file.stage, 'dev'}
name: aws
runtime: nodejs12.x
region: ${self:custom.region}
stackName: ${self:custom.appconfig.stackName}
stackTags: # Tags that will be added to each of the deployment resources
jsonsls: ${self:custom.file.stackName}
environment:
s3Bucket: ${self:custom.file.s3Bucket}
s3File: ${self:custom.file.s3File}
basePath: ${self:custom.file.basePath}
authPath: /jsonsls/${self:service}-${self:provider.stage}
region: ${self:custom.region}
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
apiGateway: # Optional API Gateway global config
shouldStartNameWithService: true
binaryMediaTypes: # Optional binary media types the API might return
- "*/*"
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:GetObject"
- "s3:PutObject"
Resource:
- "arn:aws:s3:::${self:custom.file.s3Bucket}/*"
- Effect: "Allow"
Action:
- "s3:ListBucket"
Resource:
- "arn:aws:s3:::${self:custom.file.s3Bucket}"
- Effect: "Allow"
Action:
- "ssm:GetParameter"
Resource: "*"
# The `functions` block defines what code to deploy
functions:
app:
timeout: 15
handler: ./dist/handler.handler
# The `events` block defines how to trigger the handler.helloWorld code
events:
- http:
path: /
method: ANY
cors:
origin: "*" # <-- Specify allowed origin
headers: # <-- Specify allowed headers
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-Amz-User-Agent
allowCredentials: false
- http:
path: "{proxy+}"
method: ANY
cors:
origin: "*" # <-- Specify allowed origin
headers: # <-- Specify allowed headers
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-Amz-User-Agent
allowCredentials: false
resources:
Resources:
s3BucketStorage:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.file.s3Bucket}