Amazon SimpleDB Javascript 接口可能吗?

发布于 2024-09-15 13:10:34 字数 95 浏览 7 评论 0原文

我正在查看亚马逊 simpledb 文档。他们只提到服务器端语言。

是否有办法直接从客户端将数据插入数据库而不通过服务器?

如果不是,怎么会呢?

I'm checking out amazon simpledb documentation. They mention only server side languages.

Is there anyway to insert data into the db directly from the client side without going through a server?

If not, how come?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

笑忘罢 2024-09-22 13:10:34

是和不是。由于您需要保护 AWS 的密钥(黑客可能会使用它来滥用您的帐户),因此您无法直接在 JS 中对请求进行身份验证。

虽然您可以在 JS 中创建一个实现,但它本质上是不安全的。对于某些内部用途来说,它永远无法安全部署(因为这会暴露您的密钥)。您可以做的是使用您的服务器来验证对 SimpleDB 的请求,并让 JS 执行对 Amazon 的实际请求。虽然有点迂回,但还是可以的。

缺点是您需要在客户端进行大量处理。您还可能获取比应用程序消耗/输出更多的数据,因此在客户端而不是在服务器上处理数据可能会遇到更多延迟,这仅仅是因为您将更多数据传输给用户并且处理速度更慢。

希望这有帮助

Yes and no. Since you need to protect your secret key for AWS (hackers could use it to abuse your account), you can't authenticate requests in JS directly.

While you could create an implementation in JS, it would be inherently insecure. Practical for some internal uses, it could never be safely deployed (as that would expose your secret key). What you could do instead is use your server to authenticate the requests to SimpleDB and let the JS perform the actual request to Amazon. Though it's a bit roundabout, it would work.

The downside is that you'd need to do a bunch of processing on the client side. You're also likely fetching more data than your app consumes/outputs, so processing the data on the client instead of on the server would likely encounter more latency simply because you're transferring more data to the user and processing it more slowly.

Hope this helps

可遇━不可求 2024-09-22 13:10:34

如果没有,怎么会?

安全。您使用您的开发者帐户向数据库进行身份验证。亚马逊不了解您的最终用户(它需要了解您的最终用户,以便直接从浏览器验证访问权限)。由应用程序代码决定允许最终用户做什么和不做什么。

也就是说,有 适用于 Amazon SimpleDB 的 Javascript Scratchpad 示例应用程序。它直接从浏览器访问 SimpleDB(您必须输入您的 AWS 凭证)。

If not, how come?

Security. You authenticate to the DB with your developer account. Amazon does not know about your end users (which it would need to, in order to authenticate access directly from the browser). It is up to the application code to determine what end users are allowed to do and what not.

That said, there is the Javascript Scratchpad for Amazon SimpleDB sample application. It does access SimpleDB directly from the browser (you have to type in your AWS credendials).

桜花祭 2024-09-22 13:10:34

SimeplDBAdmin 是一个基于 Javascript/PHP 的界面:

http://awsninja.com/2010/07/08/simpledbadmin-a-phpmyadmin-like-interface-for-amazon-simpledb/

PHP端是一个中继脚本[relay.php],它将通过从 Javascript 客户端发出的请求并将其发送到服务器,从服务器获取响应并为客户端重新格式化它。这是为了轻松解决 Javascript 的跨域问题[如果 Web 客户端从 www.example.com 下载了包含 javascript 代码的网页,则默认情况下只允许 javascript 连接回 www.example.com] 。

其他一切,包括请求签名,都是由 Javascript 代码完成的。

另请注意,亚马逊最近发布了一项新的测试服务,允许您在亚马逊账户下设置子账户。 simpleDB 保护非常基本(每个帐户打开或关闭),但由于它确实提供了某种有限形式的请求跟踪,因此可以说使用 Javascript 并为每个用户提供自己的用户 ID 和请求签名密钥更安全。当然,让每个用户使用相同的用户 ID 和证书是不安全的。

SimeplDBAdmin is a Javascript/PHP based interface:

http://awsninja.com/2010/07/08/simpledbadmin-a-phpmyadmin-like-interface-for-amazon-simpledb/

The PHP side is a relay script[relay.php] which will pass the requests made from the Javascript client and send them on to the server, takes the response from the server and reformats it for the client. This is to easily get around the cross-domain problems with Javascript[if the web client had downloaded the web page containing the javascript code from www.example.com it will only allow javascript to connect back to www.example.com by default].

Everything else, including request signing, is done by the Javascript code.

Also note that Amazon has released a new beta service recently to allow you to setup sub-accounts under your Amazon account. The simpleDB protection is very basic[either on or off per account] but as it does provide some limited form of request tracking, it could be argued that using Javascript and giving each user their OWN userid and key for request signing is MORE secure. Having every user use the SAME userid and certificate would, of course, be insecure.

作妖 2024-09-22 13:10:34

有一个免费的、纯 JavaScript 的界面可用。请参阅 https://chrome.google.com/webstore/detail/ddhigekdfabonefhiildaiccafacphgg

There is a free, pure JavaScript interface available. Please see https://chrome.google.com/webstore/detail/ddhigekdfabonefhiildaiccafacphgg

惯饮孤独 2024-09-22 13:10:34

请参阅有关允许安全、匿名、只读访问的类似问题的此答案来自不受信任客户端的 SimpleDB:使用 amazon simpledb 进行匿名读取

该答案的一些变化:

  • 不要将访问策略设置为只读。但是,它允许细粒度控制,因此您可能仍然希望限制允许的写入类型,
  • 而不是匿名。 有关基于令牌的身份验证的 AWS 文档示例应用程序显示并行路径:匿名访问或非匿名使用您的凭证进行 AWS/联合访问,但不会暴露您的密钥。

See this answer to the similar question on allowing secure, anonymous, read-only access to SimpleDB from untrusted clients: anonymous read with amazon simpledb .

Some variations from that answer:

  • don't set access policy to read-only. However, it allows fine grained control, so you may still wish to limit the kind of writes allowed
  • don't be anonymous. The AWS docs on token based auth and example apps show parallel paths: anonymous access or non-anonymous AWS/federated access with your credentials but without exposing your secret key.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文