AWS storage class change - amazon-web-services

I have some files in my AWS S3 bucket which i would like to put in Glacier Deep Archive from Standard Storage. After selecting the files and changing the storage class, it gives the following message.
Since the message says that it will make a copy of the files, my question is that will I be charged extra for moving my existing files to another storage class?
Thanks.
"This action creates a copy of the object with updated settings and a new last-modified date. You can change the storage class without making a new copy of the object using a lifecycle rule.
Objects copied with customer-provided encryption keys (SSE-C) will fail to be copied using the S3 console. To copy objects encrypted with SSE-C, use the AWS CLI, AWS SDK, or the Amazon S3 REST API."

Yes, changing the storage class incurs costs, regardless of whether it's done manually or via a lifecycle rule.
If you do it via the console, it will create a deep archive copy but will retain the existing one as a previous version (if you have versioning enabled), so you'll start being charged for storage both (until you delete the original version).
If you do it via a lifecycle rule, it will transition (not copy) the files, so you'll only pay for storage for the new storage class.
In both cases, you'll have to pay for LIST ($0.005 per 1000 objects in STANDARD class) and COPY/PUT ($0.05 per 1000 objects going to DEEP_ARCHIVE class) actions.
Since data is being moved within the same bucket (and therefore within the same region), there will be no data transfer fees.
The only exception to this pricing is the "intelligent tiering" class, which automatically shifts objects between storage classes based on frequency of access and does not charge for shifting classes.
No additional tiering fees apply when objects are moved between access tiers within the S3 Intelligent-Tiering storage class.

Related

AWS S3 Restore S3 Glacier Flexible Retrieval storage to S3 Standard, S3 Intelligent-Tiering, S3 Standard-IA, S3 One Zone-IA

I am trying to understand aws s3 object transitioning across various storage classes, and I am using https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html to go through details, however I find this confusing. Below is what I am trying to understand
as per this document and nice image provided on this page says that -
"Amazon S3 supports a waterfall model for transitioning between storage classes, as shown in the following diagram.".
For example, object from:
S3 Standard can be transitioned to any of --> Standard IA, Intelligent Tiering, One Zone IA, Glacier Instant, Glacier Flexible , Glacier Deep.
Which means reverse explicit transitioning is not possible
However, on same page it then says
"If you want to change the storage class of an object that is stored in S3 Glacier Flexible Retrieval to a storage class other than S3 Glacier Deep Archive, you must use the restore operation to make a temporary copy of the object first. Then use the copy operation to overwrite the object specifying S3 Standard, S3 Intelligent-Tiering, S3 Standard-IA, S3 One Zone-IA, or Reduced Redundancy as the storage class."
Here confusing part is that it shows option of overwrite the storage class (off course after restoring copy), to S3 Intelligent-Tiering, S3 Standard-IA, S3 One Zone-IA
Confusion is that - how does the aws treat this "restored" object as - a new object ? or existing object?
if it treats this as a "new" object - how can it transition directly to S3 Intelligent-Tiering, S3 Standard-IA, S3 One Zone-IA ? this contradicts to waterfall rule that they have mentioned
Thank you.
My expectation from this was that if object should be transitioned to say One Zone IA , the restored object should be first only treated as S3 Standard object - wait for 30 days and then should allow transition to S3 One Zone IA.

move S3 files with Glacier storage class to a different folder

We have a good amount of files that were on the wrong folder in S3 but has since transitioned to Glacier storage class. First thing is we want to restore them so we can move them to the right folders. Once moved we transition it back to Glacier storage class. The main question is, do those files get duplicated on the Glacier side? Since restoring them (to Standard) doesn't mean that they're being deleted or moved on the Glacier side. How do we verify that they are not duplicated after moving to a different folder in the Standard class?
Amazon S3 objects are immutable. You cannot "move" objects in S3 or Glacier.
The process would be:
Restore the objects from Glacier storage class
Rename/move them: This actually doesn't happen. Rather, the objects are copied to the new Key and then the original object is deleted. Using "Rename" in the console does this for you, as does the AWS CLI aws mv command.
Create a lifecycle rule to transition them to Glacier storage class
From CopyObject - Amazon Simple Storage Service:
If the source object's storage class is GLACIER, you must restore a copy of this object before you can use it as a source object for the copy operation.
The transition of objects to the S3 Glacier Deep Archive storage class can go only one way.
As per, https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-transition-general-considerations.html:
You cannot use a lifecycle configuration rule to convert the storage class of an object from S3 Glacier Deep Archive to any other storage class. If you want to change the storage class of an archived object to another storage class, you must use the restore operation to make a temporary copy of the object first. Then use the copy operation to overwrite the object specifying STANDARD, INTELLIGENT_TIERING, STANDARD_IA, ONEZONE_IA, S3 Glacier, or REDUCED_REDUNDANCY as the storage class.
To delete the data permananently from Glacier, Refer https://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-an-archive.html
Renaming folder involves cost. See https://stackoverflow.com/a/33006139/945214
In my case, the best solution was to delete everything and re-upload.
This is unfortunately only an option if you still have another copy.

How to change storage class In S3 the fastest way

I have around 7 TB of data in a folder in Amazon S3. I want to change the storage class from standard to one zone IA. But when it's done via UI its taking too long, might even take whole day. What's the fastest way to change the storage class?
You can create a Lifecycle Policy for an S3 Bucket.
This can automatically change the storage class for objects older than a given number of days.
So, this is the "fastest" way for you to request the change.
However, the Lifecycle policy might take up to 24-48 hours to complete, so it might not be the "fastest" to have all the objects transitioned.
You can do it different ways:
Via the console as you experienced
Via lifecycle management
Via AWS cli
Via AWS SDK (if you know any of the programming language)
You can also change the storage class of an object that is already stored in Amazon S3 to any other storage class by making a copy of the object using the PUT Object - Copy API.
You copy the object in the same bucket using the same key name and specify request headers as follows:
Set the x-amz-metadata-directive header to COPY.
Set the x-amz-storage-class to the storage class that you want to use.
In a versioning-enabled bucket, you cannot change the storage class of a specific version of an object. When you copy it, Amazon S3 gives it a new version ID.
Option 4 would be the fastest way in my case (as a developer). Looping through all the objects and copy them with the correct storage class.
Hope it helps!

How to delete glacier object?

I have created a s3 life cycle policy which will Expire the current version of the object in 540 days.
I am a bit confused here, whether it deletes the objects from s3 or glacier,
if not I want to delete the objects from a bucket in 540 days and the glacier in some 4 years! how will I set it up?
Expiring an object means "delete it", regardless of its storage class.
So, if it has moved to a Glacier storage class, it will still be deleted.
When you store data in Glacier via S3, then the object is managed by Amazon S3 (but stored in Glacier). Thus, the lifecycle rules apply.
If, however, you store data directly in Amazon Glacier (without going via Amazon S3), then the data would not be impacted by the lifecycle rules, nor would it be visible in Amazon S3.
Bottom line: Set your rules for deletion based upon the importance of the data, not its current storage class.

aws s3 glacier storage and transfer

I am trying to see if there is a way to transfer s3 objects in glacier in one bucket to another bucket but keep the storage type the same? I can restore the glacier object and transfer it, but in the new bucket, the file is saved in standard storage. I would like it to know if there is a way that the file is directly stored in glacier outside of enforcing life cycle policies on the bucket.
There isn't.
Objects can only be copied to another bucket once restored, and objects can only be transitioned into the Glacier storage class by lifecycle policies, not by creating them with this storage class ... which essentially rules out the possibility of the desired outcome for two different reasons.
S3 does not have either a "move" or a "rename" feature -- both of these can only be emulated by copy-and-delete.