简体   繁体   English

Traefik - 将请求重定向到AWS Lambda

[英]Traefik - Redirect Requests to AWS Lambda

How I redirect incoming requests to my AWS Lambda functions? 我如何将传入请求重定向到我的AWS Lambda函数?

When sends a request to api.example.com/path send it to path function in AWS Lambda. 向api.example.com/path发送请求时,请将其发送到AWS Lambda中的路径功能。

Whats must be my traefik.toml file content? 什么必须是我的traefik.toml文件内容?

Thanks. 谢谢。

You can't call AWS Lambda functions directly, unless Traefik makes specific code for that case. 除非Traefik针对该案例制定特定代码,否则您无法直接调用AWS Lambda函数。 This is because Lambda functions by default don't have inbound HTTP connections. 这是因为默认情况下Lambda函数没有入站HTTP连接。

However, once you configure AWS API Gateway for the Lambda function, then you have a HTTP endpoint that you can proxy traffic to via Traefik. 但是,一旦为Lambda函数配置AWS API网关,您就有了一个HTTP端点,您可以通过Traefik代理流量。 I recommend you use the API Gateway's Lambda proxy functionality to just pass through the HTTP requests, so you don't have to configure the API Gateway any further. 我建议您使用API​​网关的Lambda代理功能来传递HTTP请求,因此您不必再进一步配置API网关。

How to configure your traefik.toml.. https://docs.traefik.io/basics/#modifiers advices using ReplacePath modifier for Lambda use case. 如何使用ReplacePath修饰符为Lambda用例配置traefik.toml .. https://docs.traefik.io/basics/#modifiers建议。 It all depends on how you want your URL prefix structure laid out.. say do you want to be able to mount the Lambda API at root (/) or from a subresource downwards..? 这一切都取决于你希望你的URL前缀结构如何布局..你是否希望能够在根(/)或从子资源向下安装Lambda API ..?

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

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