亚马逊S3:SDK或REST API [英] Amazon S3: SDK or REST API

查看:540
本文介绍了亚马逊S3:SDK或REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用Amazon S3上传一些静态的内容编程在Java中。 当我开始阅读我发现,这样做的方式或者是通过他们的SDK(包装过的REST API)或使用REST的API。从亚马逊的AWS的网站,发现这一点:

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:

您可以使用REST API或AWS SDK将请求发送到Amazon S3。

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

本想明白,哪种方法更好。我想用SDK必将使编程更容易,但什么是直接使用SDK VS的REST API的优点和缺点。

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.

由于某些原因,我发现使用REST API直接比SDK更加困难。 我是能够做到使用SDK基础的东西 - 创造桶,列表对象,获得对象,无效缓存等。 但有一些很难写code的REST API - 尤其是生成签名

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.

可能也不会多大关系,如果我最终使用的SDK,但我仍想知道如何使用的REST API来做到这一点。如果任何人有一些很好的code在Java中对添加对象的实例,得到的对象,获取列表等,这将是非常有益的。

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.

谢谢!

推荐答案

如果你已经在你的语言的SDK,去了;这是一个没有脑子从项目的角度。 SDK是额外的工程,他们已经完成,在不增加成本测试你。换句话说,在SDK已经在HTTP REST API转换成应用程序域/语言为您服务。

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.

想想REST API作为最小公分母的AWS必须支持的,而且SDK(可能)作为执行它下面的REST API。在某些情况下(例如:一些Windows Azure的软件开发工具包),该软件开发工具包实际上是更有效,因为他们切换到基于TCP的通信信道,而不是REST(这是TCP的以及的HTTP),它消除了一些HTTP开销

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

除非你的整个目标是要花费额外的时间(开发+测试)刚学的底层REST API,我会投SDK。

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

这篇关于亚马逊S3:SDK或REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆