ECS - 任务之间的通信 [英] ECS - communication between tasks

查看:26
本文介绍了ECS - 任务之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 2 个不同的任务上部署 2 个容器(每个任务 1 个容器),一个是我的前端,另一个是我的后端服务器.我想弄清楚如何配置它们之间的通信.

I am trying to deploy 2 containers on 2 different tasks (1 container per task), one is my frontend and the other is my backend server. I am trying to figure out how to configure the communication between them.

我看到服务中的负载均衡器是一个不错的选择.但是,我应该为前端服务器配置负载均衡器,为后端配置另一个负载均衡器吗?意思是每次我有面向公众的服务和私有服务时,我都需要 2 个负载平衡器?

I saw that a load balancer in a service is a good option. However, should I configure load balancer for my front end server and another one for my backend? Meaning each time I have public-facing services and private services I need 2 load balancers?

我只想将我的前端公开给公共互联网,而我的后端将保持私有(尽管我向外界发出 API 请求 - 可能也需要配置出站路由?).

I would like to only expose my front-end to the public internet and my backend will remain private (although I make API requests to the outside world - probably need to configure outbound route too?).

我非常感谢您提供任何信息.

I would highly appreciate any information.

推荐答案

不,您不需要私人 LB.这是一个您可以使用的选项,但 ECS 此后引入了 服务发现,用于后端服务.这个想法是,您的前端通过标准 LB(例如 ALB)向您的用户公开,但可以使用此服务发现机制(基于 Route53/CloudMap)处理前端正在调用并在后台运行的服务).

No you don't need a private LB for that. It is an option you can use but ECS has since introduced the concept of Service Discovery for back-end services. The idea is that your front end is exposed to your users via a standard LB (e.g. ALB) but services that are being called by the front end and that run behind the scene can be addressed using this service discovery mechanism (based on Route53/CloudMap).

您可以在此处查看此概念的示例.这个 CFN 模板为您提供了详细信息如何构建此布局.

You can see an example of this concept here. This CFN template gives you the details re how you can build this layout.

这篇关于ECS - 任务之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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