Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Docs: s3 lifecycle policy example #1330

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions platform/src/components/aws/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,30 @@ interface BucketRef {
* });
* await getSignedUrl(new S3Client({}), command);
* ```
*
* #### Add object lifecycle
*
* If you want for example to delete files after 1 hour, you can write something like this:
*
* ```
* const bucket = new sst.aws.Bucket("MyBucket");
* // Delete files after 1 hour (using Pulumi directly)
* const lifecycleRule = new aws.s3.BucketLifecycleConfigurationV2(
* "lifecycleRule",
* {
* bucket: bucket.name,
* rules: [
* {
* id: "delete-after-1-hour",
* status: "Enabled",
* expiration: {
* days: 1 / 24, // 1 hour in days
* },
* },
* ],
* },
* );
* ```
*/
export class Bucket extends Component implements Link.Linkable {
private constructorName: string;
Expand Down