S3 with Cyberduck iteration 2

June 01, 2025

This is an overview of the work and not meaning to be a how to guide.

A small iteration while they are busy working on other items. This round I created a SNS to send to them to let them know that either something is uploaded or deleted from the bucket, while its code looking it at least lets them know there was activity in the bucket. I sent them a version highlighted for what parts to review.

The second was to add lifecycle to the folders these will auto delete after 5 days, this is to help save money if they forget to delete and should cover the time for holidays.

The last item was to create a folder just for them to upload into and have a lifecycle of 8 days as they will allow those to download 1 week. They will use the presigned URLs that was mentioned in the first iterations: <LINK>

Setup a SNS for when a file is uploaded:

Simple Notification Service

Created a topic to check when a file is uploaded into their bucket.

Change the region to yours “us-east-1”

{
  "Version": "2012-10-17",
  "Id": "AllowS3ToPublish",
  "Statement": [
    {
      "Sid": "AllowS3Publish",
      "Effect": "Allow",
      "Principal": {
     "Service": "s3.amazonaws.com"
      },
      "Action": "SNS:Publish",
      "Resource": "arn:aws:sns:us-east-1:<<AcctID>>:<<Bucket>>",
      "Condition": {
        "ArnLike": {
        "aws:SourceArn": "arn:aws:s3:::<<Bucket>>"
     }
      }
    }
  ]
}

When they get the email:

The key elements to look for:

Uploaded Item =

"eventName":"ObjectCreated:Put"
"object":{"key":"shared/"

Deleted item = 

eventName":"ObjectRemoved:Delete"
"object":{"key":"RACEWAY+CORRECTION.PDF"

Then create a subscription

When setup AWS will send a confirmation email; they will need to click the link to approve that they want to receive the notifications.

S3 Lifecycle event (delete files after X days)

What this will be doing is auto deleting the items in the folders inside the bucket.

To apply those will be create a life cycle event inside your bucket.

Choose a rule scope: Limit the scope of this rule using one or more filters

Prefix add the folders with a comma between like:

superFolder/, awesomeFolder/

The ‘/’ says this is a folder path and everything in this folder will get the life cycle policy. Since everything in a bucket is an object the folders and files are all seen as the same. If you have folders and put the policy on the bucket, it will delete the folders in the bucket. Put the policy on the highest level of the folder path you need to keep.

Lifecycle rule actions:

Click: Expire Current versions of objects

Put in the number of days after object creation, in this case 5 days, to cover holiday weekends and save cost of the items stored, in case they forget to delete. Since the life cycle runs in a lambda there could be a charge for it running, if the cost for the lifecycle shows up, we dig into seeing other options to decrease or remove that feature. While we did some cost analyst at the beginning until you start using it to see the actual usage you’ll then know for sure what the cost would be.

Pin It on Pinterest

Share This