AWS route53 domain cannot be resolved using an alias record pointing to an eks load balancer

I have configured an EKS cluster on AWS using terraform and it works totally fine. On that cluster, I created a simple nginx deployment exposed by a service which in turn, is exposed by an ingress. I can reach the landing page of that nginx server, i.e.

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

by running curl <http://dns_name_of_eks_load_balancer> where I retrieve the dns_name_of_eks_load_balancer by running kubectl get svc -n nginx-ingress and looking for the external IP of the service of type LoadBalancer. By the way, nginx-ingress is the namespace, into which I deployed an nginx ingress controller using the Helm provider of terraform.

Now, instead of using curl <http://dns_name_of_eks_load_balancer>, I want to use curl http://trading-bot.kevinsuedmersen.org to be redirected to the nginx server, where kevinsuedmersen.org is the domain I registered on AWS route53 and trading-bot.kevinsuedmersen.org should be a subdomain created by terraform. Following is the corresponding terraform code which should achieve this:

resource "aws_route53_zone" "primary_hosted_zone" {
  name = "kevinsuedmersen.org"
}

data "kubernetes_service" "load_balancer" {
  metadata {
    name = "nginx-ingress-controller"
    namespace = "nginx-ingress"
  }
}

data "aws_elb_hosted_zone_id" "hosted_zone_id" {}

resource "aws_route53_record" "trading_bot_record" {
  zone_id = aws_route53_zone.primary_hosted_zone.zone_id
  name    = "trading-bot.kevinsuedmersen.org"
  type    = "A"

  alias {
    name                   = data.kubernetes_service.load_balancer.status[0].load_balancer[0].ingress[0].hostname
    zone_id                = data.aws_elb_hosted_zone_id.hosted_zone_id.id
    evaluate_target_health = true
  }
}

output "hosted_zone_name" {
  value = aws_route53_zone.primary_hosted_zone.name
}

output "hosted_zone_id" {
  value = aws_route53_zone.primary_hosted_zone.id
}

output "load_balancer_hostname" {
  value = data.kubernetes_service.load_balancer.status[0].load_balancer[0].ingress[0].hostname
}

output "load_balancer_hosted_zone_id" {
  value = data.aws_elb_hosted_zone_id.hosted_zone_id.id
}

However after running terraform apply and then curl trading-bot.kevinsuedmersen.org I always get the error

curl: (6) Could not resolve host: trading-bot.kevinsuedmersen.org

so I think there must be some sort of problem in the domain resolution.

I read through the corresponding terraform documentation and aws documentation, but I cannot find any errors, so any help is much appreciated!

PS: Just for completeness, here is the terraform code which provisions the nginx-ingress controller and the load balancer:

resource "helm_release" "nginx_ingress" {
  name       = "nginx-ingress-controller"
  namespace = "nginx-ingress"
  create_namespace = true

  repository = "https://charts.bitnami.com/bitnami"
  chart      = "nginx-ingress-controller"

  set {
    name  = "service.type"
    value = "LoadBalancer"
  }

  depends_on = [module.eks]
}

output "nginx_ingress_manifest" {
  value = helm_release.nginx_ingress.manifest
}

and here are the kubernetes configuration files for the simple nginx deployment, service and ingress

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: "2024-09-13T18:45:03Z"
  generation: 1
  labels:
    app: nginx-deployment
  name: nginx-deployment
  namespace: default
  resourceVersion: "1634842"
  uid: c3918ec9-7281-467d-818a-b2b36b21c837
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx-deployment
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: nginx-deployment
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
status: {}
---
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    app: nginx-deployment
  name: nginx-service
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx-deployment
status:
  loadBalancer: {}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nginx-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  rules:
  - #  TODO: host: "trading-bot.kevinsuedmersen.org"
    http:
      paths:
      - pathType: Prefix
        path: "/"
        backend:
          service:
            name: nginx-service
            port:
              number: 80

6

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật