Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I define s3 lifecycle deletion policy? #3926

Closed
agamm opened this issue Oct 20, 2024 · 1 comment · May be fixed by sst/ion#1330
Closed

How can I define s3 lifecycle deletion policy? #3926

agamm opened this issue Oct 20, 2024 · 1 comment · May be fixed by sst/ion#1330

Comments

@agamm
Copy link
Contributor

agamm commented Oct 20, 2024

I want to delete files after a few hours, is it possible somehow with Bucket?

@agamm
Copy link
Contributor Author

agamm commented Oct 21, 2024

Eventually I figured it out


const bucket = new sst.aws.Bucket("MyBucket");

// Delete files after 1 day
const lifecycleRule = new aws.s3.BucketLifecycleConfigurationV2(
	"lifecycleRule",
	{
		bucket: bucket.name,
		rules: [
			{
				id: "delete-after-1-day",
				status: "Enabled",
				expiration: {
					days: 1, // 24 hours
				},
			},
		],
	},
);

@thdxr thdxr transferred this issue from sst/ion Oct 21, 2024
@agamm agamm closed this as completed Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant