Protect S3 buckets from deletion

You might want to add this policy for some extra protection to your s3 buckets.


Add the following policy to your S3 Bucket Policy to have an additional layer of protection against deleting your bucket.


{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PreventDeleteBucket",
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:DeleteBucket",
            "Resource": "arn:aws:s3:::BUCKETNAME"
        },
        {
            "Sid": "PreventDeleteObjVersion",
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:DeleteObjectVersion",
            "Resource": "arn:aws:s3:::BUCKETNAME/*"
        }
    ]
}