-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserverless.yml
64 lines (59 loc) · 1.45 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
# Welcome to Serverless!
#
# This file is the main config file for your service.
#
# For full config options, check the docs:
# docs.serverless.com
#
# Happy Coding!
service: serverless-rating # NOTE: update this with your service name
provider:
name: aws
runtime: java8
package:
artifact: build/distributions/rating.zip
functions:
getRating:
handler: rating.handler.GetHandler
events:
- http:
path: rating
method: get
cors: true
createRating:
handler: rating.handler.CreateHandler
events:
- http:
path: rating
method: post
cors: true
resources:
Resources:
DynamoDbTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: serverless
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
DynamoDBIamPolicy:
Type: AWS::IAM::Policy
DependsOn: DynamoDbTable
Properties:
PolicyName: lambda-dynamodb
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:PutItem
Resource: arn:aws:dynamodb:*:*:table/serverless
Roles:
- Ref: IamRoleLambdaExecution