-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathserverless.yml
76 lines (68 loc) · 1.96 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
service: serverless-ci-cd
provider:
name: aws
runtime: nodejs6.10 # AWS Lambda supports v.4.3.2 and v.6.10.3
# Overwrite defaults
memorySize: 512 # overwrite default memory of 1024
versionFunctions: false # don't create a new function version with each deploy
region: us-west-2 # override default region us-east-1
# Service-wide environment variables
environment:
STAGE: ${opt:stage}
# Add statements to the Lambda function's IAM Role
iamRoleStatements:
- Effect: "Allow"
Action:
- dynamodb:DescribeTable
- dynamodb:Scan
- dynamodb:Query
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:us-west-2:*:*"
# Define our lambda functions and the events they respond to
functions:
listTodos:
handler: todos/handler.list
events:
- http:
path: todos
method: get
postTodos:
handler: todos/handler.post
events:
- http:
path: todos
method: post
# Define CloudFormation resource templates here
resources:
Resources:
TodosDB:
Type: 'AWS::DynamoDB::Table'
Properties:
TableName: 'Todos-${opt:stage}'
# here we define the primary key of the table.
AttributeDefinitions:
-
AttributeName: 'id'
AttributeType: S
KeySchema:
-
AttributeName: 'id'
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: '1'
WriteCapacityUnits: '1'
custom:
dynamodb:
start:
port: 8000
# uncomment for already-running local DynamoDB
# noStart: true
output:
file: .build/stack.json # where stack output should be stored by the serverless-stack-output plugin
plugins:
- serverless-dynamodb-local # use this with serverless-offline to create local dev environment
- serverless-offline
- serverless-stack-output # store stack output in a file