1. Packages
  2. AWS
  3. API Docs
  4. route53
  5. getZone
AWS v7.14.0 published on Thursday, Dec 11, 2025 by Pulumi
aws logo
AWS v7.14.0 published on Thursday, Dec 11, 2025 by Pulumi

    aws.route53.Zone provides details about a specific Route 53 Hosted Zone.

    This data source allows to find a Hosted Zone ID given Hosted Zone name and certain search criteria.

    Example Usage

    The following example shows how to get a Hosted Zone from its name and from this data how to create a Record Set.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const selected = aws.route53.getZone({
        name: "test.com.",
        privateZone: true,
    });
    const www = new aws.route53.Record("www", {
        zoneId: selected.then(selected => selected.zoneId),
        name: selected.then(selected => `www.${selected.name}`),
        type: aws.route53.RecordType.A,
        ttl: 300,
        records: ["10.0.0.1"],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    selected = aws.route53.get_zone(name="test.com.",
        private_zone=True)
    www = aws.route53.Record("www",
        zone_id=selected.zone_id,
        name=f"www.{selected.name}",
        type=aws.route53.RecordType.A,
        ttl=300,
        records=["10.0.0.1"])
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/route53"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		selected, err := route53.LookupZone(ctx, &route53.LookupZoneArgs{
    			Name:        pulumi.StringRef("test.com."),
    			PrivateZone: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = route53.NewRecord(ctx, "www", &route53.RecordArgs{
    			ZoneId: pulumi.String(selected.ZoneId),
    			Name:   pulumi.Sprintf("www.%v", selected.Name),
    			Type:   pulumi.String(route53.RecordTypeA),
    			Ttl:    pulumi.Int(300),
    			Records: pulumi.StringArray{
    				pulumi.String("10.0.0.1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var selected = Aws.Route53.GetZone.Invoke(new()
        {
            Name = "test.com.",
            PrivateZone = true,
        });
    
        var www = new Aws.Route53.Record("www", new()
        {
            ZoneId = selected.Apply(getZoneResult => getZoneResult.ZoneId),
            Name = $"www.{selected.Apply(getZoneResult => getZoneResult.Name)}",
            Type = Aws.Route53.RecordType.A,
            Ttl = 300,
            Records = new[]
            {
                "10.0.0.1",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.route53.Route53Functions;
    import com.pulumi.aws.route53.inputs.GetZoneArgs;
    import com.pulumi.aws.route53.Record;
    import com.pulumi.aws.route53.RecordArgs;
    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 selected = Route53Functions.getZone(GetZoneArgs.builder()
                .name("test.com.")
                .privateZone(true)
                .build());
    
            var www = new Record("www", RecordArgs.builder()
                .zoneId(selected.zoneId())
                .name(String.format("www.%s", selected.name()))
                .type("A")
                .ttl(300)
                .records("10.0.0.1")
                .build());
    
        }
    }
    
    resources:
      www:
        type: aws:route53:Record
        properties:
          zoneId: ${selected.zoneId}
          name: www.${selected.name}
          type: A
          ttl: '300'
          records:
            - 10.0.0.1
    variables:
      selected:
        fn::invoke:
          function: aws:route53:getZone
          arguments:
            name: test.com.
            privateZone: true
    

    The following example shows how to get a Hosted Zone from a unique combination of its tags:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const selected = aws.route53.getZone({
        tags: {
            scope: "local",
            category: "api",
        },
    });
    export const localApiZone = selected.then(selected => selected.zoneId);
    
    import pulumi
    import pulumi_aws as aws
    
    selected = aws.route53.get_zone(tags={
        "scope": "local",
        "category": "api",
    })
    pulumi.export("localApiZone", selected.zone_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/route53"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		selected, err := route53.LookupZone(ctx, &route53.LookupZoneArgs{
    			Tags: map[string]interface{}{
    				"scope":    "local",
    				"category": "api",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("localApiZone", selected.ZoneId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var selected = Aws.Route53.GetZone.Invoke(new()
        {
            Tags = 
            {
                { "scope", "local" },
                { "category", "api" },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["localApiZone"] = selected.Apply(getZoneResult => getZoneResult.ZoneId),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.route53.Route53Functions;
    import com.pulumi.aws.route53.inputs.GetZoneArgs;
    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 selected = Route53Functions.getZone(GetZoneArgs.builder()
                .tags(Map.ofEntries(
                    Map.entry("scope", "local"),
                    Map.entry("category", "api")
                ))
                .build());
    
            ctx.export("localApiZone", selected.zoneId());
        }
    }
    
    variables:
      selected:
        fn::invoke:
          function: aws:route53:getZone
          arguments:
            tags:
              scope: local
              category: api
    outputs:
      localApiZone: ${selected.zoneId}
    

    Using getZone

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getZone(args: GetZoneArgs, opts?: InvokeOptions): Promise<GetZoneResult>
    function getZoneOutput(args: GetZoneOutputArgs, opts?: InvokeOptions): Output<GetZoneResult>
    def get_zone(enable_accelerated_recovery: Optional[bool] = None,
                 name: Optional[str] = None,
                 private_zone: Optional[bool] = None,
                 tags: Optional[Mapping[str, str]] = None,
                 vpc_id: Optional[str] = None,
                 zone_id: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetZoneResult
    def get_zone_output(enable_accelerated_recovery: Optional[pulumi.Input[bool]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 private_zone: Optional[pulumi.Input[bool]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 vpc_id: Optional[pulumi.Input[str]] = None,
                 zone_id: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetZoneResult]
    func LookupZone(ctx *Context, args *LookupZoneArgs, opts ...InvokeOption) (*LookupZoneResult, error)
    func LookupZoneOutput(ctx *Context, args *LookupZoneOutputArgs, opts ...InvokeOption) LookupZoneResultOutput

    > Note: This function is named LookupZone in the Go SDK.

    public static class GetZone 
    {
        public static Task<GetZoneResult> InvokeAsync(GetZoneArgs args, InvokeOptions? opts = null)
        public static Output<GetZoneResult> Invoke(GetZoneInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetZoneResult> getZone(GetZoneArgs args, InvokeOptions options)
    public static Output<GetZoneResult> getZone(GetZoneArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aws:route53/getZone:getZone
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnableAcceleratedRecovery bool
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    Name string
    Hosted Zone name of the desired Hosted Zone. If blank, then accept any name, filtering on only private_zone, vpc_id and tags.
    PrivateZone bool
    Filter to only private Hosted Zones.
    Tags Dictionary<string, string>

    A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.

    The arguments of this data source act as filters for querying the available Hosted Zone.

    • The given filter must match exactly one Hosted Zone.
    VpcId string
    Filter to private Hosted Zones associated with the specified vpc_id.
    ZoneId string
    and name are mutually exclusive.

    • If you use the name argument for a private Hosted Zone, you need to set the private_zone argument to true.
    EnableAcceleratedRecovery bool
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    Name string
    Hosted Zone name of the desired Hosted Zone. If blank, then accept any name, filtering on only private_zone, vpc_id and tags.
    PrivateZone bool
    Filter to only private Hosted Zones.
    Tags map[string]string

    A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.

    The arguments of this data source act as filters for querying the available Hosted Zone.

    • The given filter must match exactly one Hosted Zone.
    VpcId string
    Filter to private Hosted Zones associated with the specified vpc_id.
    ZoneId string
    and name are mutually exclusive.

    • If you use the name argument for a private Hosted Zone, you need to set the private_zone argument to true.
    enableAcceleratedRecovery Boolean
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    name String
    Hosted Zone name of the desired Hosted Zone. If blank, then accept any name, filtering on only private_zone, vpc_id and tags.
    privateZone Boolean
    Filter to only private Hosted Zones.
    tags Map<String,String>

    A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.

    The arguments of this data source act as filters for querying the available Hosted Zone.

    • The given filter must match exactly one Hosted Zone.
    vpcId String
    Filter to private Hosted Zones associated with the specified vpc_id.
    zoneId String
    and name are mutually exclusive.

    • If you use the name argument for a private Hosted Zone, you need to set the private_zone argument to true.
    enableAcceleratedRecovery boolean
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    name string
    Hosted Zone name of the desired Hosted Zone. If blank, then accept any name, filtering on only private_zone, vpc_id and tags.
    privateZone boolean
    Filter to only private Hosted Zones.
    tags {[key: string]: string}

    A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.

    The arguments of this data source act as filters for querying the available Hosted Zone.

    • The given filter must match exactly one Hosted Zone.
    vpcId string
    Filter to private Hosted Zones associated with the specified vpc_id.
    zoneId string
    and name are mutually exclusive.

    • If you use the name argument for a private Hosted Zone, you need to set the private_zone argument to true.
    enable_accelerated_recovery bool
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    name str
    Hosted Zone name of the desired Hosted Zone. If blank, then accept any name, filtering on only private_zone, vpc_id and tags.
    private_zone bool
    Filter to only private Hosted Zones.
    tags Mapping[str, str]

    A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.

    The arguments of this data source act as filters for querying the available Hosted Zone.

    • The given filter must match exactly one Hosted Zone.
    vpc_id str
    Filter to private Hosted Zones associated with the specified vpc_id.
    zone_id str
    and name are mutually exclusive.

    • If you use the name argument for a private Hosted Zone, you need to set the private_zone argument to true.
    enableAcceleratedRecovery Boolean
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    name String
    Hosted Zone name of the desired Hosted Zone. If blank, then accept any name, filtering on only private_zone, vpc_id and tags.
    privateZone Boolean
    Filter to only private Hosted Zones.
    tags Map<String>

    A map of tags, each pair of which must exactly match a pair on the desired Hosted Zone.

    The arguments of this data source act as filters for querying the available Hosted Zone.

    • The given filter must match exactly one Hosted Zone.
    vpcId String
    Filter to private Hosted Zones associated with the specified vpc_id.
    zoneId String
    and name are mutually exclusive.

    • If you use the name argument for a private Hosted Zone, you need to set the private_zone argument to true.

    getZone Result

    The following output properties are available:

    Arn string
    ARN of the Hosted Zone.
    CallerReference string
    Caller Reference of the Hosted Zone.
    Comment string
    Comment field of the Hosted Zone.
    Id string
    The provider-assigned unique ID for this managed resource.
    LinkedServiceDescription string
    The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
    LinkedServicePrincipal string
    The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
    Name string
    The Hosted Zone name.
    NameServers List<string>
    List of DNS name servers for the Hosted Zone.
    PrimaryNameServer string
    The Route 53 name server that created the SOA record.
    ResourceRecordSetCount int
    The number of Record Set in the Hosted Zone.
    Tags Dictionary<string, string>
    A map of tags assigned to the Hosted Zone.
    ZoneId string
    The Hosted Zone identifier.
    EnableAcceleratedRecovery bool
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    PrivateZone bool
    Indicates whether this is a private hosted zone.
    VpcId string
    Arn string
    ARN of the Hosted Zone.
    CallerReference string
    Caller Reference of the Hosted Zone.
    Comment string
    Comment field of the Hosted Zone.
    Id string
    The provider-assigned unique ID for this managed resource.
    LinkedServiceDescription string
    The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
    LinkedServicePrincipal string
    The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
    Name string
    The Hosted Zone name.
    NameServers []string
    List of DNS name servers for the Hosted Zone.
    PrimaryNameServer string
    The Route 53 name server that created the SOA record.
    ResourceRecordSetCount int
    The number of Record Set in the Hosted Zone.
    Tags map[string]string
    A map of tags assigned to the Hosted Zone.
    ZoneId string
    The Hosted Zone identifier.
    EnableAcceleratedRecovery bool
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    PrivateZone bool
    Indicates whether this is a private hosted zone.
    VpcId string
    arn String
    ARN of the Hosted Zone.
    callerReference String
    Caller Reference of the Hosted Zone.
    comment String
    Comment field of the Hosted Zone.
    id String
    The provider-assigned unique ID for this managed resource.
    linkedServiceDescription String
    The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
    linkedServicePrincipal String
    The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
    name String
    The Hosted Zone name.
    nameServers List<String>
    List of DNS name servers for the Hosted Zone.
    primaryNameServer String
    The Route 53 name server that created the SOA record.
    resourceRecordSetCount Integer
    The number of Record Set in the Hosted Zone.
    tags Map<String,String>
    A map of tags assigned to the Hosted Zone.
    zoneId String
    The Hosted Zone identifier.
    enableAcceleratedRecovery Boolean
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    privateZone Boolean
    Indicates whether this is a private hosted zone.
    vpcId String
    arn string
    ARN of the Hosted Zone.
    callerReference string
    Caller Reference of the Hosted Zone.
    comment string
    Comment field of the Hosted Zone.
    id string
    The provider-assigned unique ID for this managed resource.
    linkedServiceDescription string
    The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
    linkedServicePrincipal string
    The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
    name string
    The Hosted Zone name.
    nameServers string[]
    List of DNS name servers for the Hosted Zone.
    primaryNameServer string
    The Route 53 name server that created the SOA record.
    resourceRecordSetCount number
    The number of Record Set in the Hosted Zone.
    tags {[key: string]: string}
    A map of tags assigned to the Hosted Zone.
    zoneId string
    The Hosted Zone identifier.
    enableAcceleratedRecovery boolean
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    privateZone boolean
    Indicates whether this is a private hosted zone.
    vpcId string
    arn str
    ARN of the Hosted Zone.
    caller_reference str
    Caller Reference of the Hosted Zone.
    comment str
    Comment field of the Hosted Zone.
    id str
    The provider-assigned unique ID for this managed resource.
    linked_service_description str
    The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
    linked_service_principal str
    The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
    name str
    The Hosted Zone name.
    name_servers Sequence[str]
    List of DNS name servers for the Hosted Zone.
    primary_name_server str
    The Route 53 name server that created the SOA record.
    resource_record_set_count int
    The number of Record Set in the Hosted Zone.
    tags Mapping[str, str]
    A map of tags assigned to the Hosted Zone.
    zone_id str
    The Hosted Zone identifier.
    enable_accelerated_recovery bool
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    private_zone bool
    Indicates whether this is a private hosted zone.
    vpc_id str
    arn String
    ARN of the Hosted Zone.
    callerReference String
    Caller Reference of the Hosted Zone.
    comment String
    Comment field of the Hosted Zone.
    id String
    The provider-assigned unique ID for this managed resource.
    linkedServiceDescription String
    The description provided by the service that created the Hosted Zone (e.g., arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-xxxxxxxxxxxxxxxx).
    linkedServicePrincipal String
    The service that created the Hosted Zone (e.g., servicediscovery.amazonaws.com).
    name String
    The Hosted Zone name.
    nameServers List<String>
    List of DNS name servers for the Hosted Zone.
    primaryNameServer String
    The Route 53 name server that created the SOA record.
    resourceRecordSetCount Number
    The number of Record Set in the Hosted Zone.
    tags Map<String>
    A map of tags assigned to the Hosted Zone.
    zoneId String
    The Hosted Zone identifier.
    enableAcceleratedRecovery Boolean
    Boolean to indicate whether to enable accelerated recovery for the hosted zone.
    privateZone Boolean
    Indicates whether this is a private hosted zone.
    vpcId String

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v7.14.0 published on Thursday, Dec 11, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate