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

How to add static entries to a AWS Route53 Auto Naming hosted zone?

· 52CE 我爱测

I am running some of our backend REST services with Amazon ECS (Docker) and they change their public IP on every restart. I'm using AWS Route 53 Auto Naming (aka servicediscovery) to register new A records on the DNS when a new b…

问题原文

原帖链接 · Federico Bonelli · CC BY-SA 4.0

I am running some of our backend REST services with Amazon ECS (Docker) and they change their public IP on every restart.

I'm using AWS Route 53 Auto Naming (aka servicediscovery) to register new A records on the DNS when a new backend instance spins up.

Everything works fine except the backends are using HTTP. I wish to secure them with HTTPS and I was looking to Let's Encrypt/Certbot and here comes the issue.

I wish to obtain a wildcard certificate for all names in the hosted zone, let's say *.aws.example.com, but I need to add a verification TEXT record on the Hosted Zone, and it is not possible.

The error message I get is:

The resource hostedzone/Z1R8P3NTRAIWDS can only be managed through servicediscovery.amazonaws.com (arn:aws:servicediscovery:eu-west-1:263810592360:namespace/ns-cuqs46hqusim4jih)

How can I add some static records to my Hosted Zone managed by service discovery?

已采纳解答

原帖链接 · Federico Bonelli · CC BY-SA 4.0

I finally managed to resolve my issue using the procedure on section "Using Service Discovery with an Existing Hosted Zone" from documentation page: https://docs.aws.amazon.com/Route53/latest/APIReference/overview-service-discovery.html

Basically:

  1. create with autodiscovery a namespace unrelated from the previously existant public Route53 hosted zone
  2. link the autodiscovery record into the public Route53 hosted zone with the following aws-cli command aws route53 change-resource-record-sets --hosted-zone-id existing-hosted-zone-id --change-batch file://path-to-text-file

The text file is composed this way:

{
  "Changes": [
    {
      "Action": "UPSERT", 
      "ResourceRecordSet": {
        "Type":"A", 
        "Name":"record-name-in-existing-hosted-zone", 
        "AliasTarget": {
          "DNSName":"record-name-in-new-hosted-zone", 
          "HostedZoneId":"service-discovery-hosted-zone-id", 
          "EvaluateTargetHealth":true
        }
      }
    }
  ]
}

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

资料来源与适用范围

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

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

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