Deleting s3 (Standard IA) Bucket - amazon-web-services

I have a legacy S3 bucket (with data no longer required) that is 8TB - however the objects that I can see using the console only amount to approx 100mb.
I can see that there is a lifecycle policy on the bucket to transition to Standard-IA, and then permanently delete. These actions make objects noncurrent at day zero, and then moves noncurrent versions to Standard-IA at day 30. Then at day 365, all noncurrent versions are permanently deleted.
Bucket versioning is also enabled.
I would like to know what the most cost efficient way to delete this bucket is. My understanding is that although DELETE operations are free, LIST operations are not (and this is likely used). I believe this would occur if changing the lifecycle policy to delete files from 365 to say 1 day. Is there another option? Does the 'empty' option in the console remove all files without incurring an expense?

a lifecycle policy and delete operation will be free !!! , but a bucket empty option will not be free as behind the scenes empty bucket option will perform list operation before deletion.
For lifecycle policy
According to docs
You are not charged for expiration or the storage time associated with an object that has expired.
For 'empty' option
According to pricing page > requests and data retirevals
DELETE and CANCEL requests are free but it will cost you a small amount (not stated directly) because the api to delete objects requires to know the keys before deletion.
Behind the scenes of empty bucket option
It calls a LIST on the bucket, pagination through the objects in the bucket 1000 at a time. It calls a DeleteObjects API method, deleting 1000 at a time.
The cost is 1 API LIST call per 1000 objects in the bucket. Delete operations are free, so there's no extra cost there

Related

How do I only transition objects greater than 100MB to AWS Glacier from S3 Standard using AWS Lifecycle Management Policies?

I have 50TB of data in an S3 Standard bucket.
I want to transition objects that are greater than 100MB & older than 30 days to AWS Glacier using an S3 Lifecycle Policy.
How can I only transition objects that are greater than 100MB in size?
There is no way to transition items based on file size.
As the name suggests, S3 Lifecycle policies allow you to specify transition actions based on object lifetime - not file size - to move items from the S3 Standard storage class to S3 Glacier.
Now, a really inefficient & costly way that may be suggested would be to schedule a Lambda to check the S3 bucket daily, see if anything is 30 days old & then "move" items to Glacier.
However, the Glacier API does not allow you to move items from S3 Standard to Glacier unless it is through a lifecycle policy.
This means you will need to download the S3 object and then re-upload the item again to Glacier.
I would still advise having a Lambda running daily to check the file size of items, however, create another folder (key) called archive for example. If there are any items older than 30 days & greater than 100MB, copy the item from the current folder to the archive folder and then delete the original item.
Set a 0-day life-cycle policy, filtered on the prefix of the other folder (archive), which then transitions the items to Glacier ASAP.
This way, you will be able to transfer items larger than 100MB after 30 days, without paying higher per-request charges associated with uploading items to Glacier, which may even cost you more than the savings you were aiming for in the first place.
To later transition the object(s) back from Glacier to S3 Standard, use the RestoreObject API (or SDK equivalent) to restore it back into the original folder. Then finally, delete the object from Glacier using a DELETE request to the archive URL.
create a lambda that runs every day (cron job) that checks for files older than 30 days and greater then 100mb in the bucket. You can use the s3 api and glacier api.
In the "Lifecycle rule configuration" there is (from Nov 23, 2021 - see References 1.) a "Object size" form field on which you can specify both the minimum and the maximum object size.
For the sake of completeness, by default Amazon S3 does not transition objects that are smaller than 128 KB for the following transitions:
From the S3 Standard or S3 Standard-IA storage classes to S3 Intelligent-Tiering or S3 Glacier Instant Retrieval.
From the S3 Standard storage class to S3 Standard-IA or S3 One Zone-IA
References:
https://aws.amazon.com/about-aws/whats-new/2021/11/amazon-s3-lifecycle-storage-cost-savings/
https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html

How to make a Google Cloud Storage bucket append-only?

Is there a way to make a Google Cloud Storage bucket "append-only"?
To clarify, I want to make it so that trying to overwrite/modify an existing object returns an error.
Right now the only way I see to do this is client-side, by checking if the object exists before trying to write to it, but that doubles the number of calls I need to make.
There are several Google Cloud Storage features that you can enable:
Object Versioning
Bucket Lock
Retention Policies
The simplest method is to implement Object Versioning. This prevents objects from being overwritten or deleted. This does require changes to client code to know how to request a specific version of an object if multiple versions have been created due to object overwrites and deletes.
Cloud Storge Object Versioning
For more complicated scenarios implement bucket lock and retention policies. These features allow you to configure a data retention policy for a Cloud Storage bucket that governs how long objects in the bucket must be retained
Retention policies and Bucket Lock

how do i backup s3 or is it possible to backup s3?

does s3 have snapshots? how should I solve a problem where something would, for example, delete all my s3 data, how do I backup?
There are a couple options.
1. Enable versioning on your bucket. Every version of the objects will be retained. Deleting an object will just add a "delete marker" to indicate the object was deleted. You will pay for the storage of all the versions. Note that versions can also be deleted.
2. If you are just worried about deletion you can add a bucket policy to prevent deletion. You can also use some of the newer hold options.
3. You can use cross region replication to copy the objects to a bucket in a different region and optionally a different account.

Is it safe to assume that removing an AWS S3 Bucket Lifecycle Policy will not affect already transitioned objects?

I have an S3 bucket on which I activated a Lifecycle Policy that transitions objects to Glacier class storage after 14 days.
I desire to disable this policy.
Is it safe to assume that disabling/deleting the Lifecycle Policy will not alter/affect the already transitioned objects in any way?
This links specifies what happens to transition scheduling, in the event of Policy deletion.
https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-set-lifecycle-configuration-intro.html
Although it would seem evident, I didn't find it to imply about already transitioned objects remaining untouched.
My concern with this is critical due to AWS:Glacier having extreme costs for retrieval over 5% of total Glacier usage, but also for deleting files prior to 90 days.
The lifecycle policy works on the bucket itself. When you delete it/disable it, it stops performing the defined actions.
It will NOT perform actions to reverse anything. This includes glacier, deleted files, moved files, etc.

Deleting a large number of Versions from Amazon S3 Bucket

Ok so I have a slight problem I have had a back up program running on a NAS to an Amazon S3 bucket and have had versioning turned enabled on the bucket. The NAS stores around 900GB of data.
I've had this running for a number of months now, and have been watching the bill go up and up for the cost of Amazons Glacier service (which my versioning lifecycle rules stored objects in). The cost has eventually got so high that I have had to suspend Versioning on the bucket in an effort to stop any more costs.
I now have a large number of versions on all our objects screenshot example of one file:
I have two questions:
I'm currently looking for a way to delete this large number of versioned files, from Amazons own documentation it would appear I have to delete each version individually is this correct? If so what is the best way to achieve this? I assume it would be some kind of script which would have to list each item in a bucket and issue a DELETEVERSION to each versioned object? This would be a lot of requests and I guess that leads onto my next question.
What are the cost implications of deleting a large amount of Glacier objects in this way? It seems cost of deletion of objects in Glacier is expensive, does this also apply to versions created in S3?
Happy to provide more details if needed,
Thanks
Deletions from S3 are free, even if S3 has migrated the object to glacier, unless the object has been in glacier for less than 3 months, because glacier is intended for long-term storage. In that case, only, you're billed for the amount of time left (e.g., for an object stored for only 2 months, you will be billed an early deletion charge equal to 1 more month).
You will still have to identify and specify the versions to delete, but S3 accepts up to 1000 objects or versions (max 1k entites) in a single multi-delete request.
http://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html