> For the complete documentation index, see [llms.txt](https://terraform201.devart.tv/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://terraform201.devart.tv/2./route53.md).

# Route53 생성하기

## Route53 생성

* Route53은 DNS 레코드를 생성/관리하는 서비스입니다.
* 원하시는 도메인을 직접 사실 수도 있고, 외부의 도메인을 route53에 import하실 수도 있습니다
* ALB의 경우 자체 도메인이 있지만 도메인 이름이 길고 복잡하기 때문에 특정 도메인으로 연결하는 것이 보기 좋습니다.
* 또한, ALB의 도메인은 SSL이 붙어 있지 않아 보안에 취약하기 때문에, Custom 도메인을 연결하여 SSL 설정하시는 것이 좋습니다.

Route53 리소스는 아래와 같습니다.

* `zone_id` 는 등록하는 도메인의 zone ID를 의미합니다.
* `type` 은 A 레코드(IPv4)를 사용합니다. (IPv6를 원하시는 경우에는 AAAA 타입을 사용하시면 됩니다)
* `alias` 는 AWS 서비스를 직접 연결할 수 있는 기능을 의미합니다. 여기서는 ALB의 도메인을 연결을 합니다.

```hcl
##################### Route53 Record
resource "aws_route53_record" "external_dns" {
  zone_id        = var.route53_external_zone_id
  name           = var.domain_name
  type           = "A"
  set_identifier = var.aws_region

  latency_routing_policy {
    region = var.aws_region
  }

  alias {
    name                   = aws_lb.external.dns_name
    zone_id                = aws_lb.external.zone_id
    evaluate_target_health = true
  }
}
```

실제로 plan을 돌려보시면 아래와 같이 A 레코드가 생성된다고 나옵니다.

```hcl
  # module.hello.aws_route53_record.external_dns will be created
  + resource "aws_route53_record" "external_dns" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = "hello"
      + set_identifier  = "ap-northeast-2"
      + type            = "A"
      + zone_id         = "Z03407373NYH46ZMHFM7O"

      + alias {
          + evaluate_target_health = true
          + name                   = "hello-artdapne2-ext-1008005566.ap-northeast-2.elb.amazonaws.com"
          + zone_id                = "ZWKZPGTI48KDX"
        }

      + latency_routing_policy {
          + region = "ap-northeast-2"
        }
    }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://terraform201.devart.tv/2./route53.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
