forked from haydenwoodhead/burner.kiwi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudformation.json
168 lines (168 loc) · 4.91 KB
/
cloudformation.json
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Deploy burner.kiwi to lambda the easy way",
"Transform": "AWS::Serverless-2016-10-31",
"Parameters" : {
"Key" : {
"Type" : "String",
"Description" : "Key used to sign cookies and keys. Make this something strong!",
"NoEcho": "true"
},
"WebsiteURL" : {
"Type" : "String",
"Description" : "The url where the binary is being hosted. This must be internet reachable as it is the destination for mailgun routes. If you plan on using the returned cloudfront domain you will need to updated this value after stack creation."
},
"StaticURL": {
"Type": "String",
"Description": "The url where static content is being hosted. Set to /static to have the binary serve it. Otherwise set to a full domain name with protocol e.g https://static.example.com"
},
"Domains": {
"Type": "String",
"Description": "Comma separated list of domains connected to mailgun account and able to receive email"
},
"MGKey": {
"Type":"String",
"Description": "Mailgun private api key",
"NoEcho": "true"
},
"MGDomain": {
"Type": "String",
"Description": "One of the domains setup on your mailgun account"
},
"MemorySize": {
"Type": "Number",
"Description": "Memory allocated to function"
}
},
"Mappings" : {
"RegionToBucket" : {
"us-east-1" : { "Bucket" : "burner-kiwi-us-east-1"},
"ap-southeast-2" : {"Bucket" : "burner-kiwi-ap-southeast-2"},
"eu-west-1" : { "Bucket" : "burner-kiwi-eu-west-1"}
}
},
"Resources" : {
"BurnerKiwiLambda" : {
"Type" : "AWS::Serverless::Function",
"Properties" : {
"Handler" : "burnerkiwi",
"Runtime" : "go1.x",
"CodeUri" : {
"Bucket": { "Fn::FindInMap" : [ "RegionToBucket", { "Ref" : "AWS::Region" }, "Bucket"]},
"Key": "burnerkiwi.zip"
},
"FunctionName" : "burner-kiwi-main",
"Description" : "Burner.kiwi main lambda func",
"MemorySize" : {"Ref": "MemorySize"},
"Timeout" : 20,
"Policies": [
"AmazonDynamoDBFullAccess"
],
"Environment" : {
"Variables" : {
"LAMBDA":"true",
"KEY":{ "Ref" : "Key" },
"WEBSITE_URL": {"Ref": "WebsiteURL"},
"STATIC_URL": {"Ref": "StaticURL"},
"DEVELOPING": "false",
"DOMAINS": {"Ref": "Domains"},
"MG_KEY": {"Ref": "MGKey"},
"MG_DOMAIN": {"Ref": "MGDomain"},
"DB_TYPE": "dynamo",
"DYNAMO_TABLE": "burner-kiwi"
}
},
"Tags" : {
"Name": "burner.kiw lambda func",
"Burner-Kiwi": "true"
},
"Events": {
"APIGatewayRoot" : {
"Type": "Api",
"Properties" : {
"Method": "ANY",
"Path" : "/"
}
},
"APIGatewayProxy" : {
"Type": "Api",
"Properties" : {
"Method": "ANY",
"Path" : "/{proxy+}"
}
},
"DeleteOldRoutesSchedule" : {
"Type": "Schedule",
"Properties" : {
"Schedule": "rate(6 hours)"
}
}
}
}
},
"EmailsTable" : {
"Type" : "AWS::DynamoDB::Table",
"Properties" : {
"AttributeDefinitions": [
{
"AttributeName": "id",
"AttributeType": "S"
},
{
"AttributeName": "email_address",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "id",
"KeyType": "HASH"
}
],
"GlobalSecondaryIndexes": [
{
"IndexName" : "email_address-index",
"KeySchema" : [
{
"AttributeName": "email_address",
"KeyType": "HASH"
}
],
"Projection" : {
"ProjectionType": "KEYS_ONLY"
},
"ProvisionedThroughput" : {
"ReadCapacityUnits" : 2,
"WriteCapacityUnits" : 2
}
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits" : 2,
"WriteCapacityUnits" : 2
},
"TableName": "burner-kiwi",
"Tags": [
{
"Key": "Name",
"Value": "Burner Kiwi Emails Table"
},
{
"Key": "Burner-Kiwi",
"Value": "true"
}
],
"TimeToLiveSpecification": {
"AttributeName" : "ttl",
"Enabled" : "true"
}
}
}
},
"Outputs" : {
"APIGatewayURL" : {
"Description" : "API Gateway URL",
"Value": {"Fn::Join": ["", ["https://", {"Ref": "ServerlessRestApi"}, ".execute-api.", {"Ref": "AWS::Region"}, ".amazonaws.com"]]}
}
}
}