Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 doesObjectExist costs

AWS S3 Java SDK provides a method doesObjectExist() to check if an object exists in S3. What operation does it use internally? Is it GET, LIST, or HEAD ?

My concern is mainly related to its costs. From S3 documentation the costs of US west Oregon are- PUT, COPY, POST, or LIST Requests $0.005 per 1,000 requests

GET, SELECT and all other Requests $0.0004 per 1,000 requests

Does the cost of doesObjectExist() fall under 1st or 2nd category? Also I was reading somewhere that this operation requires ListBucket and GetObject permissions. So does that mean this operation incurs cost of both the above categories?

like image 441
krackoder Avatar asked Apr 13 '18 07:04

krackoder


People also ask

How much does a TB of storage cost in AWS?

Any data stored in this storage class has a pricing per terabyte of only $4.10 USD per month.

What is the cost to move objects between tiers of S3 intelligent tiering?

S3 Intelligent-Tiering pricing You pay for monthly storage, request and data transfer. When using Intelligent-Tiering you pay a small monthly per-object fee ($0.0025 per 1000 objects) for monitoring and automation. There is no retrieval fee in S3 Intelligent-Tiering and no fee for moving data between tiers.

Does S3 bucket cost in free tier?

Standard data transfers from the Internet to AWS S3 buckets are free, but data transfers outside AWS S3 incur costs. Amazon uses a tiered data transfer pricing structure, with a lower cost the more data you transfer outside the S3 service each month.


1 Answers

Looking at the code, the doesObjectExist() method internally calls getObjectMetadata (link, link).

If you go a little deeper into the code, the actual HTTP request is a HEAD request, so I strongly suspect they are just doing a HEAD on the object itself.

The description of GetObjectMetadataRequest and the HEAD call on the REST API are also similar.

Regarding permissions, you are correct (the excerpt below also comes from the HEAD request on the REST API:

You need the s3:GetObject permission for this operation. For more information, go to Specifying Permissions in a Policy in the Amazon Simple Storage Service Developer Guide. If the object you request does not exist, the error Amazon S3 returns depends on whether you also have the s3:ListBucket permission.

like image 58
Viccari Avatar answered Sep 28 '22 12:09

Viccari