AWS S3

Deleting objects from S3 in a timely manner

How to delete objects from an S3 bucket in a timely manner?

We can use LifeCycleConfiguration to do it.

  1. https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html
  2. https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-configuration-examples.html

example configuration in CloudFormation template

LifeCycleConfiguration:
  Rules:
    - Id: DeleteObjects
      ExpirationInDays: 30
      Prefix: "transit" // The name of the folder from which the files need to be deleted.
      Status: Enabled

Implementation project

This project shows the following use cases.

  1. Generating and using presigned urls to put files on S3
  2. Uploading files to S3
  3. Zipping and Unzipping files on S3 (This happens without having to story any files on the disk)
  4. Picking text files from a given S3 directory

https://github.com/explorer436/programming-playground/tree/main/java-playground/spring-cloud-examples/spring-cloud-aws-s3

Tags

  1. AWS S3 - Uploading InputStream to AWS S3 using Multipart Upload

Links to this note