AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.route53.getRecords
Explore with Pulumi AI
Use this data source to get the details of resource records in a Route 53 hosted zone.
Example Usage
Basic Usage
Return all records in the zone.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const selected = aws.route53.getZone({
    name: "test.com.",
    privateZone: true,
});
const example = selected.then(selected => aws.route53.getRecords({
    zoneId: selected.zoneId,
}));
import pulumi
import pulumi_aws as aws
selected = aws.route53.get_zone(name="test.com.",
    private_zone=True)
example = aws.route53.get_records(zone_id=selected.zone_id)
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/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.GetRecords(ctx, &route53.GetRecordsArgs{
			ZoneId: selected.ZoneId,
		}, nil)
		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 example = Aws.Route53.GetRecords.Invoke(new()
    {
        ZoneId = 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 com.pulumi.aws.route53.inputs.GetRecordsArgs;
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());
        final var example = Route53Functions.getRecords(GetRecordsArgs.builder()
            .zoneId(selected.applyValue(getZoneResult -> getZoneResult.zoneId()))
            .build());
    }
}
variables:
  selected:
    fn::invoke:
      function: aws:route53:getZone
      arguments:
        name: test.com.
        privateZone: true
  example:
    fn::invoke:
      function: aws:route53:getRecords
      arguments:
        zoneId: ${selected.zoneId}
Basic Usage with filter
Return the records that starts with www.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const selected = aws.route53.getZone({
    name: "test.com.",
    privateZone: true,
});
const example = selected.then(selected => aws.route53.getRecords({
    zoneId: selected.zoneId,
    nameRegex: "^www",
}));
import pulumi
import pulumi_aws as aws
selected = aws.route53.get_zone(name="test.com.",
    private_zone=True)
example = aws.route53.get_records(zone_id=selected.zone_id,
    name_regex="^www")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/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.GetRecords(ctx, &route53.GetRecordsArgs{
			ZoneId:    selected.ZoneId,
			NameRegex: pulumi.StringRef("^www"),
		}, nil)
		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 example = Aws.Route53.GetRecords.Invoke(new()
    {
        ZoneId = selected.Apply(getZoneResult => getZoneResult.ZoneId),
        NameRegex = "^www",
    });
});
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.inputs.GetRecordsArgs;
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());
        final var example = Route53Functions.getRecords(GetRecordsArgs.builder()
            .zoneId(selected.applyValue(getZoneResult -> getZoneResult.zoneId()))
            .nameRegex("^www")
            .build());
    }
}
variables:
  selected:
    fn::invoke:
      function: aws:route53:getZone
      arguments:
        name: test.com.
        privateZone: true
  example:
    fn::invoke:
      function: aws:route53:getRecords
      arguments:
        zoneId: ${selected.zoneId}
        nameRegex: ^www
Using getRecords
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 getRecords(args: GetRecordsArgs, opts?: InvokeOptions): Promise<GetRecordsResult>
function getRecordsOutput(args: GetRecordsOutputArgs, opts?: InvokeOptions): Output<GetRecordsResult>def get_records(name_regex: Optional[str] = None,
                zone_id: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetRecordsResult
def get_records_output(name_regex: Optional[pulumi.Input[str]] = None,
                zone_id: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetRecordsResult]func GetRecords(ctx *Context, args *GetRecordsArgs, opts ...InvokeOption) (*GetRecordsResult, error)
func GetRecordsOutput(ctx *Context, args *GetRecordsOutputArgs, opts ...InvokeOption) GetRecordsResultOutput> Note: This function is named GetRecords in the Go SDK.
public static class GetRecords 
{
    public static Task<GetRecordsResult> InvokeAsync(GetRecordsArgs args, InvokeOptions? opts = null)
    public static Output<GetRecordsResult> Invoke(GetRecordsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetRecordsResult> getRecords(GetRecordsArgs args, InvokeOptions options)
public static Output<GetRecordsResult> getRecords(GetRecordsArgs args, InvokeOptions options)
fn::invoke:
  function: aws:route53/getRecords:getRecords
  arguments:
    # arguments dictionaryThe following arguments are supported:
- zone_id str
- The ID of the hosted zone that contains the resource record sets that you want to list.
- name_regex str
- Regex string to apply to the resource record names returned by AWS.
getRecords Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- ResourceRecord List<GetSets Records Resource Record Set> 
- The resource records sets.
- ZoneId string
- NameRegex string
- Id string
- The provider-assigned unique ID for this managed resource.
- ResourceRecord []GetSets Records Resource Record Set 
- The resource records sets.
- ZoneId string
- NameRegex string
- id String
- The provider-assigned unique ID for this managed resource.
- resourceRecord List<GetSets Records Resource Record Set> 
- The resource records sets.
- zoneId String
- nameRegex String
- id string
- The provider-assigned unique ID for this managed resource.
- resourceRecord GetSets Records Resource Record Set[] 
- The resource records sets.
- zoneId string
- nameRegex string
- id str
- The provider-assigned unique ID for this managed resource.
- resource_record_ Sequence[Getsets Records Resource Record Set] 
- The resource records sets.
- zone_id str
- name_regex str
- id String
- The provider-assigned unique ID for this managed resource.
- resourceRecord List<Property Map>Sets 
- The resource records sets.
- zoneId String
- nameRegex String
Supporting Types
GetRecordsResourceRecordSet    
- AliasTarget GetRecords Resource Record Set Alias Target 
- Information about the AWS resource traffic is routed to.
- CidrRouting GetConfig Records Resource Record Set Cidr Routing Config 
- Information about the CIDR location traffic is routed to.
- Failover string
- PRIMARYor- SECONDARY.
- Geolocation
GetRecords Resource Record Set Geolocation 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- GeoproximityLocation GetRecords Resource Record Set Geoproximity Location 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- HealthCheck stringId 
- ID of any applicable health check.
- MultiValue boolAnswer 
- Traffic is routed approximately randomly to multiple resources.
- Name string
- The name of the record.
- Region string
- The Amazon EC2 Region of the resource that this resource record set refers to.
- ResourceRecords List<GetRecords Resource Record Set Resource Record> 
- The resource records.
- SetIdentifier string
- An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
- TrafficPolicy stringInstance Id 
- The ID of any traffic policy instance that Route 53 created this resource record set for.
- Ttl int
- The resource record cache time to live (TTL), in seconds.
- Type string
- The DNS record type.
- Weight int
- Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.
- AliasTarget GetRecords Resource Record Set Alias Target 
- Information about the AWS resource traffic is routed to.
- CidrRouting GetConfig Records Resource Record Set Cidr Routing Config 
- Information about the CIDR location traffic is routed to.
- Failover string
- PRIMARYor- SECONDARY.
- Geolocation
GetRecords Resource Record Set Geolocation 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- GeoproximityLocation GetRecords Resource Record Set Geoproximity Location 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- HealthCheck stringId 
- ID of any applicable health check.
- MultiValue boolAnswer 
- Traffic is routed approximately randomly to multiple resources.
- Name string
- The name of the record.
- Region string
- The Amazon EC2 Region of the resource that this resource record set refers to.
- ResourceRecords []GetRecords Resource Record Set Resource Record 
- The resource records.
- SetIdentifier string
- An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
- TrafficPolicy stringInstance Id 
- The ID of any traffic policy instance that Route 53 created this resource record set for.
- Ttl int
- The resource record cache time to live (TTL), in seconds.
- Type string
- The DNS record type.
- Weight int
- Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.
- aliasTarget GetRecords Resource Record Set Alias Target 
- Information about the AWS resource traffic is routed to.
- cidrRouting GetConfig Records Resource Record Set Cidr Routing Config 
- Information about the CIDR location traffic is routed to.
- failover String
- PRIMARYor- SECONDARY.
- geolocation
GetRecords Resource Record Set Geolocation 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- geoproximityLocation GetRecords Resource Record Set Geoproximity Location 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- healthCheck StringId 
- ID of any applicable health check.
- multiValue BooleanAnswer 
- Traffic is routed approximately randomly to multiple resources.
- name String
- The name of the record.
- region String
- The Amazon EC2 Region of the resource that this resource record set refers to.
- resourceRecords List<GetRecords Resource Record Set Resource Record> 
- The resource records.
- setIdentifier String
- An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
- trafficPolicy StringInstance Id 
- The ID of any traffic policy instance that Route 53 created this resource record set for.
- ttl Integer
- The resource record cache time to live (TTL), in seconds.
- type String
- The DNS record type.
- weight Integer
- Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.
- aliasTarget GetRecords Resource Record Set Alias Target 
- Information about the AWS resource traffic is routed to.
- cidrRouting GetConfig Records Resource Record Set Cidr Routing Config 
- Information about the CIDR location traffic is routed to.
- failover string
- PRIMARYor- SECONDARY.
- geolocation
GetRecords Resource Record Set Geolocation 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- geoproximityLocation GetRecords Resource Record Set Geoproximity Location 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- healthCheck stringId 
- ID of any applicable health check.
- multiValue booleanAnswer 
- Traffic is routed approximately randomly to multiple resources.
- name string
- The name of the record.
- region string
- The Amazon EC2 Region of the resource that this resource record set refers to.
- resourceRecords GetRecords Resource Record Set Resource Record[] 
- The resource records.
- setIdentifier string
- An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
- trafficPolicy stringInstance Id 
- The ID of any traffic policy instance that Route 53 created this resource record set for.
- ttl number
- The resource record cache time to live (TTL), in seconds.
- type string
- The DNS record type.
- weight number
- Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.
- alias_target GetRecords Resource Record Set Alias Target 
- Information about the AWS resource traffic is routed to.
- cidr_routing_ Getconfig Records Resource Record Set Cidr Routing Config 
- Information about the CIDR location traffic is routed to.
- failover str
- PRIMARYor- SECONDARY.
- geolocation
GetRecords Resource Record Set Geolocation 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- geoproximity_location GetRecords Resource Record Set Geoproximity Location 
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- health_check_ strid 
- ID of any applicable health check.
- multi_value_ boolanswer 
- Traffic is routed approximately randomly to multiple resources.
- name str
- The name of the record.
- region str
- The Amazon EC2 Region of the resource that this resource record set refers to.
- resource_records Sequence[GetRecords Resource Record Set Resource Record] 
- The resource records.
- set_identifier str
- An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
- traffic_policy_ strinstance_ id 
- The ID of any traffic policy instance that Route 53 created this resource record set for.
- ttl int
- The resource record cache time to live (TTL), in seconds.
- type str
- The DNS record type.
- weight int
- Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.
- aliasTarget Property Map
- Information about the AWS resource traffic is routed to.
- cidrRouting Property MapConfig 
- Information about the CIDR location traffic is routed to.
- failover String
- PRIMARYor- SECONDARY.
- geolocation Property Map
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- geoproximityLocation Property Map
- Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
- healthCheck StringId 
- ID of any applicable health check.
- multiValue BooleanAnswer 
- Traffic is routed approximately randomly to multiple resources.
- name String
- The name of the record.
- region String
- The Amazon EC2 Region of the resource that this resource record set refers to.
- resourceRecords List<Property Map>
- The resource records.
- setIdentifier String
- An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
- trafficPolicy StringInstance Id 
- The ID of any traffic policy instance that Route 53 created this resource record set for.
- ttl Number
- The resource record cache time to live (TTL), in seconds.
- type String
- The DNS record type.
- weight Number
- Among resource record sets that have the same combination of DNS name and type, a value that determines the proportion of DNS queries that Amazon Route 53 responds to using the current resource record set.
GetRecordsResourceRecordSetAliasTarget      
- DnsName string
- Target DNS name.
- EvaluateTarget boolHealth 
- Whether an alias resource record set inherits the health of the referenced AWS resource.
- HostedZone stringId 
- Target hosted zone ID.
- DnsName string
- Target DNS name.
- EvaluateTarget boolHealth 
- Whether an alias resource record set inherits the health of the referenced AWS resource.
- HostedZone stringId 
- Target hosted zone ID.
- dnsName String
- Target DNS name.
- evaluateTarget BooleanHealth 
- Whether an alias resource record set inherits the health of the referenced AWS resource.
- hostedZone StringId 
- Target hosted zone ID.
- dnsName string
- Target DNS name.
- evaluateTarget booleanHealth 
- Whether an alias resource record set inherits the health of the referenced AWS resource.
- hostedZone stringId 
- Target hosted zone ID.
- dns_name str
- Target DNS name.
- evaluate_target_ boolhealth 
- Whether an alias resource record set inherits the health of the referenced AWS resource.
- hosted_zone_ strid 
- Target hosted zone ID.
- dnsName String
- Target DNS name.
- evaluateTarget BooleanHealth 
- Whether an alias resource record set inherits the health of the referenced AWS resource.
- hostedZone StringId 
- Target hosted zone ID.
GetRecordsResourceRecordSetCidrRoutingConfig       
- CollectionId string
- The CIDR collection ID.
- LocationName string
- The CIDR collection location name.
- CollectionId string
- The CIDR collection ID.
- LocationName string
- The CIDR collection location name.
- collectionId String
- The CIDR collection ID.
- locationName String
- The CIDR collection location name.
- collectionId string
- The CIDR collection ID.
- locationName string
- The CIDR collection location name.
- collection_id str
- The CIDR collection ID.
- location_name str
- The CIDR collection location name.
- collectionId String
- The CIDR collection ID.
- locationName String
- The CIDR collection location name.
GetRecordsResourceRecordSetGeolocation     
- ContinentCode string
- The two-letter code for the continent.
- CountryCode string
- The two-letter code for a country.
- SubdivisionCode string
- The two-letter code for a state of the United States.
- ContinentCode string
- The two-letter code for the continent.
- CountryCode string
- The two-letter code for a country.
- SubdivisionCode string
- The two-letter code for a state of the United States.
- continentCode String
- The two-letter code for the continent.
- countryCode String
- The two-letter code for a country.
- subdivisionCode String
- The two-letter code for a state of the United States.
- continentCode string
- The two-letter code for the continent.
- countryCode string
- The two-letter code for a country.
- subdivisionCode string
- The two-letter code for a state of the United States.
- continent_code str
- The two-letter code for the continent.
- country_code str
- The two-letter code for a country.
- subdivision_code str
- The two-letter code for a state of the United States.
- continentCode String
- The two-letter code for the continent.
- countryCode String
- The two-letter code for a country.
- subdivisionCode String
- The two-letter code for a state of the United States.
GetRecordsResourceRecordSetGeoproximityLocation      
- AwsRegion string
- The AWS Region the resource you are directing DNS traffic to, is in.
- Bias int
- The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a resource.
- Coordinates
GetRecords Resource Record Set Geoproximity Location Coordinates 
- Contains the longitude and latitude for a geographic region.
- LocalZone stringGroup 
- An AWS Local Zone Group.
- AwsRegion string
- The AWS Region the resource you are directing DNS traffic to, is in.
- Bias int
- The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a resource.
- Coordinates
GetRecords Resource Record Set Geoproximity Location Coordinates 
- Contains the longitude and latitude for a geographic region.
- LocalZone stringGroup 
- An AWS Local Zone Group.
- awsRegion String
- The AWS Region the resource you are directing DNS traffic to, is in.
- bias Integer
- The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a resource.
- coordinates
GetRecords Resource Record Set Geoproximity Location Coordinates 
- Contains the longitude and latitude for a geographic region.
- localZone StringGroup 
- An AWS Local Zone Group.
- awsRegion string
- The AWS Region the resource you are directing DNS traffic to, is in.
- bias number
- The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a resource.
- coordinates
GetRecords Resource Record Set Geoproximity Location Coordinates 
- Contains the longitude and latitude for a geographic region.
- localZone stringGroup 
- An AWS Local Zone Group.
- aws_region str
- The AWS Region the resource you are directing DNS traffic to, is in.
- bias int
- The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a resource.
- coordinates
GetRecords Resource Record Set Geoproximity Location Coordinates 
- Contains the longitude and latitude for a geographic region.
- local_zone_ strgroup 
- An AWS Local Zone Group.
- awsRegion String
- The AWS Region the resource you are directing DNS traffic to, is in.
- bias Number
- The bias increases or decreases the size of the geographic region from which Route 53 routes traffic to a resource.
- coordinates Property Map
- Contains the longitude and latitude for a geographic region.
- localZone StringGroup 
- An AWS Local Zone Group.
GetRecordsResourceRecordSetGeoproximityLocationCoordinates       
GetRecordsResourceRecordSetResourceRecord      
- Value string
- The DNS record value.
- Value string
- The DNS record value.
- value String
- The DNS record value.
- value string
- The DNS record value.
- value str
- The DNS record value.
- value String
- The DNS record value.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.