forked from YarivGilad/serverless-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.yml
147 lines (138 loc) · 4.21 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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!
# The `service` block is the name of the service
service: serverless-starter
plugins:
# - serverless-dynamodb-local # DYNAMODB plugin
# - serverless-offline-scheduler # SCHEDULING plugin
- serverless-offline
# exclude the code coverage files, examples and circle ci files
package:
exclude:
- coverage/**
- .circleci/**
- examples/**
custom:
# serverless-offline:
# provider:
# environment: ${file(env.yml)}
# dynamodb:
# start:
# port: 8080
# inMemory: true
# migrate: true
# migration:
# dir: migrations
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=1.27.3"
# The `provider` block defines where your service will be deployed
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage} # set the stage based on what Circle Branch is deploying
region: eu-west-2 # default is us-east-1
# environment: ${file(env.yml)} # for dev - serverless-offline, alternatively pass env vals as options
# environment:
# SERVICE_USER: ${opt:service_user} # pass in your environment variables as options from Circle
# SERVICE_SEC: ${opt:service_sec}
# SERVICE_URL: https://app.beapplied.com/api/
cfLogs: true # enable logging
apiKeys:
- starter-api-key # https://serverless.com/framework/docs/providers/aws/events/apigateway#setting-api-keys-for-your-rest-api
iamRoleStatements:
- Effect: Allow
Action: # logging permissions
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:DescribeLogStreams
- logs:PutLogEvents
- logs:CreateSubscriptionFilter
- logs:PutSubscriptionFilter
Resource: "arn:aws:logs:${opt:region, self:provider.region}:serverless:log-group:/aws/cognito/*"
# - Effect: Allow
# Action:
# - dynamodb:Query
# - dynamodb:Scan
# - dynamodb:GetItem
# - dynamodb:PutItem
# - dynamodb:UpdateItem
# - dynamodb:DeleteItem
# Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/job-scores"
# The `functions` block defines what code to deploy
functions:
hello:
handler: index.hello
events:
- http:
path: /
method: get
cors: true
getEpoch:
handler: index.getEpoch
timeout: 10 # optional, in seconds, default is 6
events:
- schedule: # SCHEDULING
name: get-epoch-every-minute
description: 'get-epoch-every-minute'
rate: rate(1 minute) # https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#RateExpressions
enable: true
- http:
path: /get-epoch
method: get
cors: true
fkReadability:
handler: index.fkReadability
events:
- http:
path: /flesch-kincaid
method: post
private: true
cors: true
saveFkReadabilityScore:
handler: index.saveFkReadabilityScore
events:
- http:
path: /save-fkscore/{jobId}
method: post
private: true
cors: true
request:
parameters:
paths:
jobId: true
# you can add CloudFormation resource templates here
# resources:
# Resources:
# JobsScoresDynamoDbTable:
# Type: 'AWS::DynamoDB::Table'
# DeletionPolicy: Retain
# Properties:
# AttributeDefinitions:
# -
# AttributeName: job_id
# AttributeType: N
# -
# AttributeName: score
# AttributeType: N
# KeySchema:
# -
# AttributeName: job_id
# KeyType: HASH
# -
# AttributeName: score
# KeyType: RANGE
# ProvisionedThroughput:
# ReadCapacityUnits: 10
# WriteCapacityUnits: 10
# TableName: job-scores