-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yml
79 lines (74 loc) · 1.96 KB
/
template.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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
htmx-shortener
Parameters:
OAUTHKEY:
Type: String
NoEcho: true
OAUTHSECRET:
Type: String
NoEcho: true
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 5
Resources:
ShortenerFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: shortener/
Handler: bootstrap
Runtime: provided.al2
Events:
CatchAll:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
Root:
Type: Api
Properties:
Path: /
Method: ANY
Environment:
Variables:
DDB_TABLE: !Ref ShortenerTable
OAUTH_KEY: !Ref OAUTHKEY
OAUTH_SECRET: !Ref OAUTHSECRET
OAUTH_DOMAIN: "https://shortener.lucaspearson.com/auth/callback/google"
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref ShortenerTable
- AmazonDynamoDBFullAccess
Metadata:
BuildMethod: makefile
ShortenerTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
-
AttributeName: pk
AttributeType: S
-
AttributeName: sk
AttributeType: S
KeySchema:
-
AttributeName: pk
KeyType: HASH
-
AttributeName: sk
KeyType: RANGE
TableName: shortener-ddb-table
BillingMode: PAY_PER_REQUEST
Outputs:
ShortenerAPI:
Description: "API Gateway endpoint URL"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
ShortenerFunction:
Description: "Shortener Function ARN"
Value: !GetAtt ShortenerFunction.Arn
ShortenerFunctionIamRole:
Description: "Implicit IAM Role created for Shortener function"
Value: !GetAtt ShortenerFunctionRole.Arn