Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon S3: SDK or REST API [closed]

I have to use Amazon S3 to upload some static contents programmatically in Java. When I started reading I found that the way to do is either through their SDK (wrapper over REST APIs) or using REST APIs. From Amazon's AWS website, found this:

"You can send requests to Amazon S3 using the REST API or the AWS SDK".

Wanted to understand that which approach is better. I think using SDK will definitely make programming easier, but what are the pros and cons of using SDK Vs Rest APIs directly.

For some reason, I found using REST API directly more difficult than SDK. I was able to do basic things using SDk - create bucket, list objects, get object, invalidate cache etc. But was having some hard time writing the code for REST API - especially generating the signature.

May be it will not matter much, if I ultimately use SDK, but I would still like to know how to do it using REST APIs. If anyone has some good code examples in Java on adding objects, get objects, get list etc, it would be very helpful.

Thanks!

like image 510
user1270392 Avatar asked Apr 02 '13 01:04

user1270392


People also ask

What is AWS S3 SDK?

Amazon Simple Storage Service (Amazon S3) is a web service that provides highly scalable cloud storage. Amazon S3 provides easy to use object storage, with a simple web service interface to store and retrieve any amount of data from anywhere on the web. The JavaScript API for Amazon S3 is exposed through the AWS.

Does AWS have a REST API?

A REST API in API Gateway is a collection of resources and methods that are integrated with backend HTTP endpoints, Lambda functions, or other AWS services. You can use API Gateway features to help you with all aspects of the API lifecycle, from creation through monitoring your production APIs.

Is S3 a protocol or API?

S3 is what is considered an HTTP REST API. It's an API that uses HTTP requests to get, put, post and delete data. The REST API is considered a “stateless” protocol, where the server does not store any state about the client sessions on its side.


1 Answers

If you already have the SDK in your language, go for it; it's a no-brainer from a project perspective. The SDK is additional engineering that they have already done and tested for you at no additional cost. In other words, the SDK is already converting the HTTP REST API into the application domain/language for you.

Think of the REST API as a the lowest common denominator that AWS must support and that the SDK (likely) as implementing the REST API below it. In some cases (eg: some Windows Azure SDKs), the SDKs are actually more efficient because they switch to a TCP based communications channel instead of REST (which is TCP plus HTTP), which eliminate some of the HTTP overhead

Unless your entire goal is to spend additional time (development + testing) just to learn the underlying REST API, I'd vote SDK.

like image 67
DeepSpace101 Avatar answered Oct 13 '22 13:10

DeepSpace101