get Hosted Zone Id
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
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lb.LbFunctions;
import com.pulumi.aws.lb.inputs.GetHostedZoneIdArgs;
import com.pulumi.aws.route53.Record;
import com.pulumi.aws.route53.RecordArgs;
import com.pulumi.aws.route53.inputs.RecordAliasArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var main = LbFunctions.getHostedZoneId();
var www = new Record("www", RecordArgs.builder()
.zoneId(aws_route53_zone.primary().zone_id())
.name("example.com")
.type("A")
.aliases(RecordAliasArgs.builder()
.name(aws_lb.main().dns_name())
.zoneId(main.applyValue(getHostedZoneIdResult -> getHostedZoneIdResult.id()))
.evaluateTargetHealth(true)
.build())
.build());
}
}
Return
A collection of values returned by getHostedZoneId.
Parameters
A collection of arguments for invoking getHostedZoneId.
Return
A collection of values returned by getHostedZoneId.
Parameters
Type of load balancer to create. Possible values are application
or network
. The default value is application
.
Name of the region whose AWS ELB HostedZoneId is desired. Defaults to the region from the AWS provider configuration.
See also
Return
A collection of values returned by getHostedZoneId.
Parameters
Builder for com.pulumi.aws.lb.kotlin.inputs.GetHostedZoneIdPlainArgs.