-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
59 lines (53 loc) · 1.32 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
service: movie-service
provider:
name: aws
runtime: nodejs18.x
stage: ${opt:stage}
region: eu-west-2
environment:
DDB_TABLE_NAME: ${self:custom.tableName}
DEPLOYMENT_REGION: ${self:provider.region}
deploymentBucket:
name: bernardo-demo-deployment-bucket
serverSideEncryption: AES256
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Scan
- dynamodb:GetItem
Resource: arn:aws:dynamodb:${self:provider.region}:*:table/${self:custom.tableName}
custom:
tableName: ${self:service}-${self:provider.stage}
plugins:
- serverless-deployment-bucket
- serverless-better-credentials
functions:
getAllMovies:
handler: handlers/get-all-movies.getAllMovies
events:
- http:
path: movies
method: get
cors: true
getMovieById:
handler: handlers/get-movie-by-id.getMovieById
events:
- http:
path: movies/{id}
method: get
cors: true
resources:
Resources:
MovieTable:
Type: 'AWS::DynamoDB::Table'
Properties:
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: id
AttributeType: N
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST