This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathserverless.yml
108 lines (97 loc) · 2.53 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
96
97
98
99
100
101
102
103
104
105
106
107
108
service: serverless-url-shortener
provider:
name: aws
runtime: nodejs4.3
stage: dev
region: eu-west-1
# you can add statements to the Lambda function's IAM Role here
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:*"
Resource:
Fn::Join:
- ""
- - "arn:aws:dynamodb:"
- "Ref" : "AWS::Region"
- ":"
- "Ref" : "AWS::AccountId"
- ":table/"
- "Ref" : "TrackedResourcesTable"
- Effect: "Allow"
Action:
- "dynamodb:*"
Resource:
Fn::Join:
- ""
- - "arn:aws:dynamodb:"
- "Ref" : "AWS::Region"
- ":"
- "Ref" : "AWS::AccountId"
- ":table/"
- "Ref" : "TrackedResourcesTable"
- "/index/"
- "sls-url-shortener-trackers-${opt:stage}"
package:
exclude:
- .idea
- coverage/**
- spec/**
functions:
listResource:
handler: code/lambda/shortener/list/handler.handler
events:
- http:
path: resource
method: get
deleteResource:
handler: code/lambda/shortener/delete/handler.handler
events:
- http:
path: resource/{uuid}
method: delete
createResource:
handler: code/lambda/shortener/create/handler.handler
events:
- http:
path: resource
method: post
resolveResource:
handler: code/lambda/resolver/get/handler.handler
events:
- http:
path: l/{tracker}
method: get
# you can add CloudFormation resource templates here
resources:
Resources:
TrackedResourcesTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: sls-url-shortener-urls-${opt:stage}
AttributeDefinitions:
- AttributeName: uuid
AttributeType: S
- AttributeName: tracker
AttributeType: S
KeySchema:
- AttributeName: uuid
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: sls-url-shortener-trackers-${opt:stage}
KeySchema:
- AttributeName: tracker
KeyType: HASH
Projection:
ProjectionType: "ALL"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
# Outputs:
# UrlTable:
# Description: "Table containing every Url shortened"
# Value:
# - "Ref" : "urlsTable"