Ubuntu 22.04 Backup using Amazon S3 and rclone

From Notes_Wiki

Home > Ubuntu > Ubuntu 22.04 > Ubuntu 22.04 Backup using Amazon S3 and rclone

1. Creating 7 Daily Buckets with 6-Day Immutability

  • Log in to your AWS account and open the S3 console.
  • Click Create Bucket, enter a unique name, and confirm creation.
  • Open the newly created bucket and go to the Properties tab.
  • Under Bucket Versioning, click Enable (required for object lock).
  • Scroll to Object Lock, click Edit, and enable it.
  • Enable Default Retention:
  • Choose Compliance mode.
  • Set retention period to 6 days.
  • Save changes.

2. Writing Lifecycle Policies for Permanent Deletion after Rclone Deletes

When using rclone to delete objects from an S3 bucket, AWS retains these objects as "deleted objects" if Versioning is enabled. To permanently remove them after 1 day, a Lifecycle Policy must be created.

  • Open the AWS S3 Console and your target bucket.
  • Go to the Management tab > Lifecycle Rules > Create Lifecycle Rule.
  • Set a name and choose to apply the rule to all objects.
  • Select the following actions:
  • Permanently delete noncurrent versions of objects
  • Delete expired object delete markers
  • Set "Days after object deletion" to 1.
  • Click Create Rule.