-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsst.config.ts
98 lines (93 loc) · 2.63 KB
/
sst.config.ts
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
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "thesobercoder-stack",
removal: input?.stage === "production" ? "retain" : "remove",
protect: input?.stage === "production",
home: "aws",
};
},
async run() {
const stage = $app.stage ?? "dev";
const domain =
stage === "production"
? {
name: "thesobercoder.in",
redirects: ["www.thesobercoder.in"],
}
: {
name: `${stage}.thesobercoder.in`,
};
// TODO: Visit this later when/if WAF is availble for other regions
// because we are deploying to ap-south-1 and WAF is only available in us-east-1
// const waf = new aws.wafv2.WebAcl("thesobercoder-waf", {
// description: "WAF rules for CloudFront distribution",
// scope: "CLOUDFRONT",
// defaultAction: {
// allow: {},
// },
// rules: [
// // Rate limiting rule
// {
// name: "RateLimit",
// priority: 1,
// statement: {
// rateBasedStatement: {
// limit: 300, // Requests per 5 minutes per IP
// aggregateKeyType: "IP",
// },
// },
// action: {
// block: {},
// },
// visibilityConfig: {
// cloudwatchMetricsEnabled: true,
// metricName: "RateLimitRule",
// sampledRequestsEnabled: true,
// },
// },
// // Common Rule Set (protects against common web exploits)
// {
// name: "CommonRules",
// priority: 2,
// overrideAction: {
// none: {},
// },
// statement: {
// managedRuleGroupStatement: {
// name: "AWSManagedRulesCommonRuleSet",
// vendorName: "AWS",
// },
// },
// visibilityConfig: {
// cloudwatchMetricsEnabled: true,
// metricName: "CommonRules",
// sampledRequestsEnabled: true,
// },
// },
// ],
// visibilityConfig: {
// cloudwatchMetricsEnabled: true,
// metricName: "thesobercoder-waf",
// sampledRequestsEnabled: true,
// },
// });
const site = new sst.aws.Nextjs("thesobercoder-website", {
domain,
transform: {
cdn: {
transform: {
distribution(args) {
args.webAclId = undefined;
},
},
},
},
buildCommand: "bun run sst:build",
});
return {
url: site.url,
};
},
});