AWS API Gateway提供S3内容和Lambda

Kev*_*inB 4 amazon-s3 amazon-web-services aws-lambda aws-api-gateway aws-certificate-manager

我已经使用ACM创建了SSL证书。我想使用此证书来同时提供S3存储桶中的静态内容和lambda。目前,我想避免使用CloudFront并通过API Gateway代理S3和Lambda,以便所有内容都从单个SSL域提供(没有CORS问题)。

理想情况下,我会打电话给:

https://my.customdomain.com/ (lambda redirects to /web/index.html)
https://my.customdomain.com/api/* (lambdas)
https://my.customdomain.com/web/* (static content - s3)
Run Code Online (Sandbox Code Playgroud)

以上架构合理/可行吗?

小智 5

是的,该架构是可能的。

API网关具有此目标。用作未向客户公开的后端服务的网关。与API Gateway集成的选项之一是与Amazon S3。

基本上,您会将对象密钥转发给S3,并使用S3 API调用(由API Gateway执行)来请求该对象。您只需要授予API网关正确的权限即可使用适当的凭据进行此调用。

您可以在此处找到完成此工作所需的信息。