- Newest
- Most votes
- Most comments
Hello.
Data storage costs are lower with S3 than with EFS.
In your case, you are currently only storing 2 GB of data, so there is not a huge difference in price between S3 and EFS, but if your data increases in the future, S3 will be cheaper.
https://aws.amazon.com/s3/pricing/?nc1=h_ls
Additionally, since S3 also has archive storage, you can use it to further reduce costs.
https://docs.aws.amazon.com/amazonglacier/latest/dev/introduction.html
Also, if you use S3, I think the step of uploading to EC2 will be unnecessary.
You can upload and download files directly to S3 using the SDK or AWS CLI.
https://docs.aws.amazon.com/AmazonS3/latest/API/Welcome.html
I would also advise looking at S3 rather than paying for EC2 instances and using EFS, but you should note a few important things about S3 storage classes.
First, all the classes with lower storage costs come with a minimum duration for which you get charged, regardless of how long you actually retain the object. For Standard-IA and Glacier Instant Retrieval, it's 30 days, for Glacier Flexible Retrieval 90 days, and for Glacier Deep Archive, 180 days. If you upload a file today and replace it with a new one a week later, at the least expensive Glacier Deep Archive storage class, you'll have to pay for both the old and new file version for a minimum of 180 days each. If you delete the older file (object) before the 30, 90, or 180 days are up, you'll be charged for the remaining period at the moment of deletion/overwriting, not over the course of the remaining number of days.
Secondly, the cheaper storage classes also come with special rules for calculating the billable amount of storage. For Standard-IA and Glacier Instant Retrieval, you get charged for a minimum of 128 kiB, regardless of the size of the object. If you upload a 7-kiB file of code, for example, you'll be charged for 128 kiB of storage storing it in Standard-IA or Glacier Instant Retrieval.
For Glacier Flexible Retrieval and Glacier Deep Archive, there's no minimum size for an object, but in addition to the size of the contents of the file, you get charged for each object (file) an additional 8 kiB at the Standard storage class rate for storing the object name, timestamp, and other basic information, and 32 kiB at the rate of the archive storage class you chose for the object, used to store other metadata for the object.
In practice, if you store a 7-kiB source code file in S3, your most cost-efficient option is to keep it at the Standard class, despite the nominal storage cost being the highest over all available classes. For Glacier Instant Retrieval, the per-byte storage cost would be 5.75x cheaper than Standard, but you'd get charged for 128 kiB, which would be 18.3x the amount of billable stored data, making it more expensive, even before considering the potential impact of the 30-day minimum storage period.
In your specific case, I would first check if the data could be split to two separate categories. One would be the text-based source code and markdown, where changes would presumably occur rather frequently and across the whole collection of files. I would try combining only those files (excluding the videos, PDFs, and possibly pictures, zip files, etc. non-text files) into a tarball and compressing it with zstd (Zstandard). My expectation would be that the files would compress very well, but that the amount of data would still be substantial, maybe around 100-200 MiB. That would be very cost-efficient to store in Glacier Deep Archive, despite the a new version of the file having to be created every few days that you're making the backups. For example, if you uploaded a 200-MiB file every 3 days and kept each version for the 180 days that you get billed for anyway, the continuous storage cost (after the number of versions had first ramped up to the full 60) would be: 0.1953125 GiB/version × 60 versions × $0.00099/GiB/mo ≈ $0.0116/mo That cost would cover all the 60 versions, so in addition to the latest uploaded tarball, the cost would cover all the 180 days of history.
Note that Deep Archive is an offline storage class, meaning that you can't access the files directly in Deep Archive. You have to make an API call to commence a restore process to "thaw" the object from its frozen state, producing a separately charged online copy that you can download while restoring backups. Notably, the restore request for Deep Archive is designed to take 12 hours to complete, and you'll only be able to start downloading the restored files after that, exceeding your 12-hour RTO requirement by the amount of time that the download takes. The above approach requires you to relax the RTO by that much.
The non-compressible video files and PDFs probably don't change often but new ones are added every now and then. With their larger sizes, it would be inefficient to make tarballs of them containing many copies of the same, unchanged files. I would upload them to S3 directly and set lifecycle rules to transition them to cheaper storage classes based on size. Files under 128 kiB should stay in the Standard class and larger ones I would transition to Glacier Instant Retrieval. Glacier Instant Retrieval has about 5.75x cheaper per-byte storage cost over Standard, and it's an online storage class, so the 12-hour restoration process isn't needed, making it easy for you to start downloading those files with the AWS CLI (aws s3 sync or aws s3 cp) while the chosen compressed tarball is undergoing the restore process on AWS's side.
Whether your entire data set fits in your $0.50/mo budget depends entirely on the numbers and sizes of your files, but this is about as close as you can get without building complex custom code to micro-optimise the storage classes, tarballing, and other tricks for the non-text files.
Relevant content
asked 3 years ago

Thank you. I figured out the same after diving deeper into S3 Pricing.
I settled with this: All objects <128KB stay in standard. For others, transition to Standard-IA after 30 days and to Glacier-Flexible after 60 days.
Looking into retrieval, I found out that bulk retrieval in Glacier-Flexible is free. Is there any caveats in this, because it looks too good to be true?
It's true that there's no charge based on the amount of data for bulk-restoring an object from Glacier Flexible Retrieval. There are per-request fees, though, $0.0004 per 1,000 GET and certain other types of requests, but no per-gigabyte charge. Also note that you won't only be paying for storing your data but also an extra 8 kiB at Standard rate per object for storing the archived object's name, timestamps, etc. and an extra 32 kiB at the Flexible Retrieval rate for storing other metadata and index data for the object, so those would be the caveat compared to Glacier IR or Standard-IA.
One more point to note is that during a restore from the offline Glacier classes, you'll pay for the storage of both the object that remains offline in the archive class and the copy that is temporary made available online as a result of the restore operation. This is probably not that relevant for you, since restorations would be rare, but just to point that out as a pricing difference to all the online storage classes.
Do the usual request charges apply for In Glacier-Flexible Retrieval bulk restore, as I am "getting" data from one bucket and "putting" it into another?
When the restore request has been completed, you'll be charged for the storage of the still-frozen archive object and the restored online copy. Normal request fees for the Glacier Flexible Retrieval class will apply to downloading the restored copy (
GetObject) or making copies of it inside S3 (CopyObject).