问题原文
原帖链接 · 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 :)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
