AWS Route 53 VPC Association Authorization

This page shows how to write Terraform and CloudFormation for Route 53 VPC Association Authorization and write them securely.

aws_route53_vpc_association_authorization (Terraform)

The VPC Association Authorization in Route 53 can be configured in Terraform with the resource name aws_route53_vpc_association_authorization. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

route53.tf#L1
resource "aws_route53_vpc_association_authorization" "private" {
  count = terraform.workspace != "main" ? 1 : 0  # only for cross account

  zone_id = local.private_hosted_zone.zone_id
  vpc_id  = module.shared_vpc.vpc.id

route53-ecr.tf#L1
resource "aws_route53_vpc_association_authorization" "private_ecr" {
  count = terraform.workspace != "main" ? 1 : 0  # only for cross account

  zone_id = local.private_dns_zone_ecr_vpce.zone_id
  vpc_id  = module.shared_vpc.vpc.id

main.tf#L7
resource "aws_route53_vpc_association_authorization" "this" {
  vpc_id     = var.vpc_id
  vpc_region = var.vpc_region
  zone_id    = var.zone_id
}

route53_vpc_association_authorization.tf#L4
resource "aws_route53_vpc_association_authorization" "route53_vpc_association_authorization" {
  count = var.enable_route53_vpc_association_authorization ? 1 : 0

  zone_id = var.route53_vpc_association_authorization_zone_id
  vpc_id  = var.route53_vpc_association_authorization_vpc_id

route53_vpc_association_authorization.tf#L4
resource "aws_route53_vpc_association_authorization" "route53_vpc_association_authorization" {
  count = var.enable_route53_vpc_association_authorization ? 1 : 0

  zone_id = var.route53_vpc_association_authorization_zone_id
  vpc_id  = var.route53_vpc_association_authorization_vpc_id

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Authorizes a VPC in a different account to be associated with a local Route53 Hosted Zone.

AWS::Route53::HostedZone VPC (CloudFormation)

The HostedZone VPC in Route53 can be configured in CloudFormation with the resource name AWS::Route53::HostedZone VPC. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

VPCId Private hosted zones only: The ID of an Amazon VPC.
For public hosted zones, omit VPCs, VPCId, and VPCRegion. Required: Yes
Type: String
Update requires: No interruption

VPCRegion Private hosted zones only: The region that an Amazon VPC was created in.
For public hosted zones, omit VPCs, VPCId, and VPCRegion. Required: Yes
Type: String
Allowed values: af-south-1 | ap-east-1 | ap-northeast-1 | ap-northeast-2 | ap-northeast-3 | ap-south-1 | ap-southeast-1 | ap-southeast-2 | ca-central-1 | cn-north-1 | eu-central-1 | eu-north-1 | eu-south-1 | eu-west-1 | eu-west-2 | eu-west-3 | me-south-1 | sa-east-1 | us-east-1 | us-east-2 | us-gov-east-1 | us-gov-west-1 | us-iso-east-1 | us-isob-east-1 | us-west-1 | us-west-2
Update requires: No interruption

Explanation in CloudFormation Registry

Private hosted zones only: A complex type that contains information about an Amazon VPC. Route 53 Resolver uses the records in the private hosted zone to route traffic in that VPC. Note For public hosted zones, omit VPCs, VPCId, and VPCRegion.

Frequently asked questions

What is AWS Route 53 VPC Association Authorization?

AWS Route 53 VPC Association Authorization is a resource for Route 53 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Route 53 VPC Association Authorization?

For Terraform, the cicdenv/cicdenv, cicdenv/cicdenv and niveklabs/aws source code examples are useful. See the Terraform Example section for further details.