-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserverless.yml
74 lines (68 loc) · 1.6 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
service: serverless-cvm
plugins:
- serverless-pseudo-parameters
custom:
environment: ${file(env.yml):dev}
package:
exclude:
- certs/**
- img/**
provider:
name: aws
runtime: nodejs10.x
stage: dev
region: us-east-1
iamRoleStatements:
- Effect: Allow
Action:
- iot:CreateThing
- iot:AttachPolicy
- iot:DetachPolicy
- iot:AttachThingPrincipal
- iot:DetachThingPrincipal
- iot:CreatePolicy
- iot:CreateKeysAndCertificate
- iot:UpdateCertificate
- iot:DeleteCertificate
- iot:GetThingShadow
- iot:UpdateThingShadow
Resource:
- "*"
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:UpdateItem
Resource:
- "Fn::GetAtt": [ DeviceInfoDynamoDBTable, Arn ]
- Effect: Allow
Action:
- logs:*
Resource:
- arn:aws:logs:*:*:*
functions:
cvm:
handler: cvm/index.handler
events:
- http:
path: getcert
method: get
- http:
path: shadow
method: any
environment:
REGION: "#{AWS::Region}"
DYNAMODB_TABLE_NAME: !Ref DeviceInfoDynamoDBTable
IOT_DATA_ENDPOINT: ${self:custom.environment.IOT_DATA_ENDPOINT}
resources:
Resources:
DeviceInfoDynamoDBTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: iot-cvm-device-info
AttributeDefinitions:
- AttributeName: serialNumber
AttributeType: S
KeySchema:
- AttributeName: serialNumber
KeyType: HASH
BillingMode: PAY_PER_REQUEST