-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserverless.yml
101 lines (87 loc) · 2.26 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
service: sls-test-project
provider:
name: aws
runtime: nodejs6.10
stage: dev
region: us-east-1
memorySize: 512
timeout: 15
iamRoleStatements:
- Effect: Allow # access to DynamoDB
Action:
- dynamodb:*
Resource:
- 'Fn::Join':
- '/'
-
- 'Fn::Join':
- ':'
-
- arn:aws:dynamodb
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- table
- Ref: TestDynamoDbTable
stackTags: # Optional CF stack tags
environment: ${opt:stage, self:provider.stage}
application: ${self:service}
product: something
environment:
SERVERLESS_PROJECT_NAME: ${self:service} # FIXME Required for Sessions
SERVERLESS_PROJECT: ${self:service}
SERVERLESS_STAGE: ${self:custom.stage}
SERVERLESS_REGION: ${self:custom.region}
# Auth
TEST_TABLE_NAME:
Ref: TestDynamoDbTable
plugins:
- serverless-offline
- serverless-webpack
- serverless-aws-alias
custom:
stage: ${opt:stage, self:provider.stage}
region: ${opt:region, self:provider.region}
# Stage dependent variables.
# Usage: ${self:custom.${self:custom.stage}.<varname>}
dev:
testvar: test-${self:custom.stage}
prod:
testvar: test-${self:custom.stage}
webpack: ./webpack.lambda.config.js
webpackIncludeModules: true
functions:
testfct1:
description: 'Echo function echoes alias'
handler: handlers/testfct1/handler.handle
events:
- http:
method: GET
path: /func1
- stream:
type: dynamodb
arn:
Fn::GetAtt:
- TestDynamoDbTable
- StreamArn
resources:
Resources:
TestDynamoDbTable:
Type: AWS::DynamoDB::Table
DeletionPolicy: Delete
Properties:
AttributeDefinitions:
- AttributeName: myKey
AttributeType: S
KeySchema:
- AttributeName: myKey
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
Outputs:
TestDynamoDbTableName:
Description: Test DynamoDB Table Name
Value:
Ref: TestDynamoDbTable