Skip to content

Data Source: awsLbHostedZoneId

Use this data source to get the HostedZoneId of the AWS Elastic Load Balancing (ELB) in a given region for the purpose of using in an AWS Route53 Alias. Specify the ELB type (network or application) to return the relevant the associated HostedZoneId. Ref: ELB service endpoints

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsLbHostedZoneIdMain =
  new aws.dataAwsLbHostedZoneId.DataAwsLbHostedZoneId(this, "main", {});
new aws.route53Record.Route53Record(this, "www", {
  alias: {
    evaluateTargetHealth: true,
    name: "${aws_lb.main.dns_name}",
    zoneId: dataAwsLbHostedZoneIdMain.id,
  },
  name: "example.com",
  type: "A",
  zoneId: "${aws_route53_zone.primary.zone_id}",
});

Argument Reference

  • region - (Optional) Name of the region whose AWS ELB HostedZoneId is desired. Defaults to the region from the AWS provider configuration.

  • loadBalancerType - (Optional) Type of load balancer to create. Possible values are application or network. The default value is application.

Attributes Reference

  • id - ID of the AWS ELB HostedZoneId in the selected region.