大网数据广告活动
服务器运维问答

Idiomatic way to get IP addresses of group of containers in ECS?

· 52CE 我爱测

I'm building an internal proxy service on AWS where a user can send a request to a server that server will send the request to one of several proxy containers in an ECS cluster I'm not sure what's the best way to get the IP addre…

问题原文

原帖链接 · Foobar · CC BY-SA 4.0

I'm building an internal proxy service on AWS where a user can

  • send a request to a server
  • that server will send the request to one of several proxy containers in an ECS cluster

I'm not sure what's the best way to get the IP addresses of the proxy containers in the ECS cluster.

I could manually list the IPs once every N seconds and check if new containers have joined the ECS cluster, but I wonder if there's a better way?

已采纳解答

原帖链接 · MLu · CC BY-SA 4.0

You can listen for CloudWatch Events or AWS EventBridge Events related to container spin-up / tear-down. You can probably trigger a lambda for each event that can then do something, like add the container IP to a wherever it needs to be registered.

Alternatively you can use ECS Service Discovery that uses DNS to keep a list of active containers.

And finally you can get the containers to register themselves when they spin up. That's also an option, though a bit more DIY'ish.

Hope that helps :)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-03-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。