forked from anomalyco/sst
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsst.config.ts
More file actions
38 lines (36 loc) · 776 Bytes
/
Copy pathsst.config.ts
File metadata and controls
38 lines (36 loc) · 776 Bytes
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
/// <reference path="./.sst/platform/config.d.ts" />
/**
* ## Bucket lifecycle policies
*
* Configure S3 bucket lifecycle policies to expire objects automatically.
*/
export default $config({
app(input) {
return {
name: "aws-bucket-lifecycle-rules",
home: "aws",
removal: input?.stage === "production" ? "retain" : "remove",
};
},
async run() {
const bucket = new sst.aws.Bucket("MyBucket", {
lifecycle: [
{
expiresIn: "60 days",
},
{
id: "expire-tmp-files",
prefix: "tmp/",
expiresIn: "30 days",
},
{
prefix: "data/",
expiresAt: "2028-12-31",
},
],
});
return {
bucket: bucket.name,
};
},
});