-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
135 lines (128 loc) · 3.62 KB
/
template.yaml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
AWSTemplateFormatVersion: "2010-09-09"
Description: lumina
Globals:
Function:
Timeout: 60
MemorySize: 512
Environment:
Variables:
ENVIRONMENT: !Ref Environment
STAGE_NAME: !Ref Environment
VCS_REV: !Ref VcsRev
SENTRY_DSN: "https://[email protected]/6169889"
# Here we specify the different environment that we have
Parameters:
Environment:
Type: String
VcsRev:
Type: String
Resources:
BasicAWSApiGateway:
Type: AWS::Serverless::Api
Properties:
Name: !Join ["", ["lumina-endpoint-", !Ref Environment]]
StageName: !Ref Environment
PythonDependencyLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: !Join ["", ["lumina-dependencies-", !Ref Environment]]
Description: Dependencies for Lumina
ContentUri: dependencies/
CompatibleRuntimes:
- python3.10
RetentionPolicy: Delete
Metadata:
BuildMethod: python3.10
LuminaMember:
Type: AWS::DynamoDB::Table
DeletionPolicy: Retain
UpdateReplacePolicy: Retain
Properties:
TableName: !Join ["", ["LuminaMember-", !Ref Environment]]
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: pk
KeyType: HASH
- AttributeName: sk
KeyType: RANGE
AttributeDefinitions:
- AttributeName: pk
AttributeType: S
- AttributeName: sk
AttributeType: S
- AttributeName: target_type
AttributeType: S
- AttributeName: target_id
AttributeType: S
GlobalSecondaryIndexes:
- IndexName: gsi_sk
KeySchema:
- AttributeName: sk
KeyType: HASH
Projection:
ProjectionType: ALL
- IndexName: gsi_submission_target
KeySchema:
- AttributeName: target_type
KeyType: HASH
- AttributeName: target_id
KeyType: RANGE
Projection:
ProjectionType: ALL
LuminaService:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Join ["", ["lumina-", !Ref Environment]]
CodeUri: src/
Handler: handler.handler
Runtime: python3.10
Layers:
- !Ref PythonDependencyLayer
Policies:
- KMSDecryptPolicy:
KeyId: f45fa5dd-e730-4e79-93f0-e24d2079e4c6
- SSMParameterReadPolicy:
ParameterName: "lumina/*"
- SESCrudPolicy:
IdentityName: [email protected]
- DynamoDBCrudPolicy:
TableName: !Ref LuminaMember
Events:
LuminaEndpointGet:
Type: Api
Properties:
Path: /{path+}
Method: get
RestApiId: !Ref BasicAWSApiGateway
LuminaEndpointPut:
Type: Api
Properties:
Path: /{path+}
Method: put
RestApiId: !Ref BasicAWSApiGateway
LuminaEndpointPatch:
Type: Api
Properties:
Path: /{path+}
Method: patch
RestApiId: !Ref BasicAWSApiGateway
LuminaEndpointPost:
Type: Api
Properties:
Path: /{path+}
Method: post
RestApiId: !Ref BasicAWSApiGateway
LuminaEndpointDelete:
Type: Api
Properties:
Path: /{path+}
Method: delete
RestApiId: !Ref BasicAWSApiGateway
LuminaEndpointOptions:
Type: Api
Properties:
Path: /{path+}
Method: options
RestApiId: !Ref BasicAWSApiGateway
Transform:
- AWS::Serverless-2016-10-31