-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
95 lines (89 loc) · 2.02 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
# serverless.yml
service: serverless-movies
plugins:
- serverless-python-requirements
- serverless-wsgi
- serverless-dynamodb-local
custom:
tableName: 'movies-table-${self:provider.stage}'
omdbApiParam: 'OMDBApiKey'
wsgi:
app: api.app.app
packRequirements: false
pythonRequirements:
dockerizePip: non-linux
dynamodb:
start:
migrate: true
stages:
- dev
- prod
provider:
name: aws
runtime: python3.8
stage: dev
region: us-east-1
apiKeys:
- testKey
iamRoleStatements:
- Effect: Allow
Action:
- ssm:GetParameter
Resource:
- "arn:aws:ssm:*:*:parameter/${self:custom.omdbApiParam}"
- Effect: Allow
Action: dynamodb:ListTables
Resource: "*"
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:DescribeTable
Resource:
- { "Fn::GetAtt": ["MoviesDynamoDBTable", "Arn" ] }
environment:
MOVIES_TABLE: ${self:custom.tableName}
OMDB_API_PARAM: ${self:custom.omdbApiParam}
functions:
app:
handler: wsgi_handler.handler
events:
- http:
path: movies
method: get
- http:
path: movies/{proxy+}
method: get
- http:
path: movies
method: post
private: true
- http:
path: movies/{proxy+}
method: put
private: true
- http:
path: movies/{proxy+}
method: delete
private: true
resources:
Resources:
MoviesDynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
-
AttributeName: title
AttributeType: S
KeySchema:
-
AttributeName: title
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 10
WriteCapacityUnits: 10
TableName: ${self:custom.tableName}