用于从S3存储桶提供静态内容的AWS API网关方法 [英] AWS API Gateway Method to Serve static content from S3 Bucket

查看:114
本文介绍了用于从S3存储桶提供静态内容的AWS API网关方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过API网关提供lambda微服务,这似乎不是一个大问题.

I want to serve my lambda microservices through API Gateway which seems not to be a big problem.

我的每个微服务都有所提供资源的JSON-Schema规范.由于它是静态文件,因此我希望通过S3存储桶提供该文件 而不是也运行lambda函数来为其提供服务.

Every of my microservices has a JSON-Schema specification of the resource provided. Since it is a static file, I would like to serve it from an S3 Bucket rather than also running a lambda function to serve it.

所以

GET,POST,PUT,DELETE http://api.domain.com/ressources

应转发给lambda函数.我要

should be forwarded to a lambda function. I want

GET http://api.domain.com/ressources/schema

从S3提供我的schema.json.

to serve my schema.json from S3.

我幼稚的第一个方法是为"/v1/contracts/schema-GET-Integration Request"设置资源和方法,并将其配置为充当HTTP代理,其端点url直指合同JSON-Schema.我收到500-内部服务器错误.

My naive first approach was to setup the resource and methods for "/v1/contracts/schema - GET - Integration Request" and configure it to behave as an HTTP Proxy with endpoint url pointing straight to the contracts JSON-Schema. I get a 500 - Internal Server error.

                    Execution log for request test-request
Fri Nov 27 09:24:02 UTC 2015 : Starting execution for request: test-invoke-request
Fri Nov 27 09:24:02 UTC 2015 : API Key: test-invoke-api-key
Fri Nov 27 09:24:02 UTC 2015 : Method request path: {}
Fri Nov 27 09:24:02 UTC 2015 : Method request query string: {}
Fri Nov 27 09:24:02 UTC 2015 : Method request headers: {}
Fri Nov 27 09:24:02 UTC 2015 : Method request body before transformations: null
Fri Nov 27 09:24:02 UTC 2015 : Execution failed due to configuration error: Invalid endpoint address

我是走错了路径还是只是错过了一些配置?

Am I on a complete wrong path or do I just miss some configurations ?

推荐答案

不幸的是,在将TestInvoke与API Gateway代理一起使用到同一区域内的Amazon S3(和其他一些AWS服务)时,存在一个限制.一旦部署,情况就不会如此,但是如果要从控制台进行测试,则需要在其他区域中使用存储桶.

Unfortunately there is a limitation when using TestInvoke with API Gateway proxying to Amazon S3 (and some other AWS services) within the same region. This will not be the case once deployed, but if you want to test from the console you will need to use a bucket in a different region.

我们知道这个问题,但是我不能保证何时解决该问题.

We are aware of the issue, but I can't commit to when this issue would be resolved.

这篇关于用于从S3存储桶提供静态内容的AWS API网关方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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