简体   繁体   English

AWS API Gateway服务S3内容和Lambda

[英]AWS API Gateway Serve S3 Content and Lambda

I have created an SSL certificate with ACM. 我用ACM创建了一个SSL证书。 I would like to use this certificate to serve both my static content from an S3 bucket and my lambdas. 我想使用此证书来提供来自S3存储桶和我的lambdas的静态内容。 At this time, I want to avoid using CloudFront and proxy both S3 and Lambda with API Gateway so that everything is served from a single SSL domain (no CORS issues). 目前,我希望避免使用CloudFront并使用API​​网关代理S3和Lambda,以便从单个SSL域提供所有内容(无CORS问题)。

Ideally, I will call: 理想情况下,我会打电话:

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

Is the above architecture reasonable/possible? 上述架构是否合理/可行?

Yes, the architecture is possible. 是的,架构是可行的。

API Gateway has this objective. API Gateway具有此目标。 To serve as a Gateway for backend services that are not exposed to your customer. 作为未向客户公开的后端服务的网关 One of the options to integrate with API Gateway is with Amazon S3. 与API Gateway集成的一个选项是Amazon S3。

Basically you will foward the object key to S3 and request this object using S3 API Calls (executed by API Gateway). 基本上,您将向S3发送对象密钥,并使用S3 API调用(由API网关执行)请求此对象。 You'll just need to give API Gateway the correct permissions to make this call with the proper credentials. 您只需要为API Gateway提供正确的权限,即可使用正确的凭据进行此调用。

You can find the information needed to make this work here . 您可以在此处找到使其工作所需的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM