-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
79 lines (72 loc) · 1.86 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
service: aws-lambda-serverless-crud-java
frameworkVersion: '3'
provider:
name: aws
runtime: java8
stage: development
region: us-west-2
# ENVIRONMENT VARIABLES
environment:
REGION: ${opt:region, self:provider.region}
AUTHOR_TABLE: javatodev-author-${opt:stage, self:provider.stage}
# IAM ROLES TO ACCESS DYNAMODB TABLES
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:BatchGetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- !GetAtt AuthorDynamoDBTable.Arn
resources:
Resources:
AuthorDynamoDBTable:
Type: "AWS::DynamoDB::Table"
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: "id"
AttributeType: "S"
KeySchema:
- AttributeName: "id"
KeyType: "HASH"
StreamSpecification:
StreamViewType: "NEW_AND_OLD_IMAGES"
TableName: ${self:provider.environment.AUTHOR_TABLE}
package:
artifact: build/distributions/aws-serverless-crud-java.zip
functions:
base_api:
handler: com.serverless.Handler
events:
- httpApi:
path: /
method: get
author_registration:
handler: com.serverless.author.RegistrationHandler
events:
- httpApi:
path: /authors/registration
method: post
author_reads:
handler: com.serverless.author.ReadHandler
events:
- httpApi:
path: /authors
method: get
author_update:
handler: com.serverless.author.UpdateHandler
events:
- httpApi:
path: /authors/{id}
method: patch
author_delete:
handler: com.serverless.author.DeleteHandler
events:
- httpApi:
path: /authors/{id}
method: delete