winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.06k stars 198 forks source link

Create AWS S3 Lifecycle Rules #7177

Open obrunsmann opened 1 month ago

obrunsmann commented 1 month ago

Use Case

In several cases I need to configure lifecycle rules for automatic expiration of objects in a S3 bucket. For example to clean temporary file uploads after one day.

Proposed Solution

let bucket = new cloud.Bucket(rules: [{
  "id" => "deleteFileUploads",
  "filter" => ["prefix" => "tmp/"],
  "expiration" => ["days" => 7],
}]);

Terraform API: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration

Implementation Notes

No response

Component

Compiler

Community Notes