aws s3 how to protect against accidental deletion - amazon-web-services

I want to have a protection against accidental deletion on our s3 bucket, so i delete an object i can restore it for 1 day before definitive deletion.
What i try:
Enable versionning on the bucket
Create a lifecycle rule with "Permanently delete noncurrent versions of objects", "Delete expired object delete markers or incomplete multipart upload"
But with this when i delete an object i can restore it, but if i didn't resstore it it's never definitively deleted

Related

Delete S3 Object(all versions) from primary bucket while replicating it to cross region bucket

We have a use case where our application upload backups to s3 bucket and same has been replicate to cross region bucket for disaster recovery.
Sometime backup fail to upload complete backup. In such case we have to delete already uploaded backup. But I am curious about the replication. If I am going to delete object which is currently actively replicating(in progress replication) to cross region, will it be possible to delete that object or will have to wait until complete replication of that object.
If its possible to delete object which is now replicating then what will happen to destination bucket object which is partially replicated. It should be manually deleted or how to do stuff with that?

Prevent Accidental Deletion of AWS S3 Buckets

On initiating service instance deletion call, Object Store service ensures deletion of service instance resources, which includes AWS S3 bucket(s), and hence the objects in the bucket also gets deleted. Since there is no backup or a backup is very costly, is there any way where I can avoid this accidental deletion of important data?
We can use the parameter 'preventDeletion' which if enable wont let you delete a file

Delete an object in AWS S3

I'm trying to understand the delete operation of an object in aws S3.
In cross region replication, if I delete an object from the source, this delete is not propagated to the destination.
The official text - "If you specify an object version ID to delete in
a DELETE request, Amazon S3 deletes that object version in the source
bucket, but it doesn't replicate the deletion in the destination
bucket. In other words, it doesn't delete the same object version from
the destination bucket. This protects data from malicious deletions. "
In other case, I read that
The official text - Amazon S3 offers eventual consistency for
overwrite PUTS and DELETES in all Regions
When I made a test, the delete is not propagated. Then, there is a divergence between the replica !
Is it normal ? how about the eventual consistency of the delete ?
This is not about replication, it's about simple buckets from Introduction to AWS S3.
Amazon S3 offers eventual consistency for overwrite PUTS and DELETES in all Regions
The right answer - "it doesn't delete the same object version from the destination bucket. This protects data from malicious deletions".
If you need "consistency of the delete" - you can try to automate it with aws s3 sync with --delete flag.

Can I restore S3 objects from deleted folder with glacier storage class

I recently deleted by error a complete folder in an S3 bucket without versioning activated. This folder used to have a lifecycle policy, a lot of objects were in a glacier state. Now I can't find them, event in a vault.
Can I retrieve the deleted folder or is it a lost cause?
Unfortunately, I believe if you didn't have versioning running on the bucket to the best of my knowledge you cannot recover the items.
As stated on https://docs.aws.amazon.com/AmazonS3/latest/user-guide/undelete-objects.html
"To be able to undelete a deleted object, you must have had versioning
enabled on the bucket that contains the object before the object was
deleted."

S3 versioning - why leave an expired delete marker behind?

I'm adding a lifecycle rule for a versioned bucket, and I'm confused about this:
Specifically, the "remove expired object delete marker" option. Why would one not want to remove that? If I have an object with just one version, and I delete that object/version, five days later it will be permanently deleted. Then there's a delete marker hanging around pointing to nothing, so what's the point of keeping it?
Amazon S3 will not automatically delete expired object delete markers. The lifecycle policy provides a means to do so.
Deleting the last version of an object that has a delete marker will merely delete the object. It does not trigger an action on S3 to determine whether there are any expired delete markers. So, yes, the lifecycle rule is worth implementing if the bucket is versioned and versions of objects are often deleted.