简体   繁体   English

如何手动将 dns 条目添加到 AWS ECS 服务发现管理的托管区域?

[英]How to manually add dns entries to hosted zone managed by AWS ECS service discovery?

I am using service discovery for containers in AWS ECS, for a private hosted zone staging.example.com.我正在为 AWS ECS 中的容器使用服务发现,用于私有托管区域staging.example.com. . .

Now, next to containers I would like to map an AWS RDS database to db.staging.example.com .现在,在容器旁边,我想 map 一个 AWS RDS 数据库到db.staging.example.com However, I cannot modify the Route53 hosted zone, as AWS denies me access because the zone is managed by service discovery但是,我无法修改 Route53 托管区域,因为 AWS 拒绝我访问,因为该区域由服务发现管理

AccessDenied: The resource hostedzone/*** can only be managed through servicediscovery.amazonaws.com (***)

Any advice on how I can accomplish my custom subdomain is greatly appreciated.非常感谢有关如何完成自定义子域的任何建议。 There is also Cloud Map and App Mesh as AWS services with similar goals regarding dns management, but I could not find any documentation regarding my scenario.还有 Cloud Map 和 App Mesh 作为 AWS 服务,在 dns 管理方面具有类似的目标,但我找不到任何关于我的场景的文档。

It turns out, AWS Service Discovery uses Cloud Map API to fulfill its service.事实证明,AWS Service Discovery 使用 Cloud Map API 来完成其服务。 It registers containers in the hosted zone by adding SRV entries, which refer to A entries and specific ports.它通过添加引用A条目和特定端口的SRV条目在托管区域中注册容器。 This means, your clients need to understand those SRV entries as they will not get A entries straight away when performing dns lookups.这意味着,您的客户需要了解这些SRV条目,因为他们在执行 dns 查找时不会立即获得A条目。 Curl, for example, does not understand SRV entries .例如,Curl不理解SRV条目

Therefore, I returned to using ECS with automatic load balancer registration.因此,我重新使用 ECS 和自动负载均衡器注册。 Then, ECS will register new services in a target group which was previously mapped in a load balancer's listener.然后,ECS 将在先前映射到负载均衡器侦听器中的目标组中注册新服务。 DNS entries are then managed completely independent, by adding some alias entries which point to the load balancer, while others like the db.staging.example.com entry aliases the RDS databases endpoint. DNS 条目然后通过添加一些指向负载均衡器的别名条目来完全独立地管理,而其他类似db.staging.example.com条目的条目别名 RDS 数据库端点。

Since you can have ECS services register themselves in multiple target groups, you can also use multiple load balancers, eg one for public access and one only accessible within your VPC.由于您可以让 ECS 服务在多个目标组中注册自己,因此您还可以使用多个负载均衡器,例如,一个用于公共访问,一个只能在您的 VPC 内访问。

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

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