AWS v6.77.1 published on Friday, Apr 18, 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.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.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.
 - Resource
Record List<GetSets Records Resource Record Set>  - The resource records sets.
 - Zone
Id string - Name
Regex string 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Resource
Record []GetSets Records Resource Record Set  - The resource records sets.
 - Zone
Id string - Name
Regex string 
- id String
 - The provider-assigned unique ID for this managed resource.
 - resource
Record List<GetSets Records Resource Record Set>  - The resource records sets.
 - zone
Id String - name
Regex String 
- id string
 - The provider-assigned unique ID for this managed resource.
 - resource
Record GetSets Records Resource Record Set[]  - The resource records sets.
 - zone
Id string - name
Regex 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.
 - resource
Record List<Property Map>Sets  - The resource records sets.
 - zone
Id String - name
Regex String 
Supporting Types
GetRecordsResourceRecordSet    
- 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 string
 PRIMARYorSECONDARY.- Geolocation
Get
Records 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 stringId  - ID of any applicable health check.
 - Multi
Value 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.
 - Resource
Records List<GetRecords Resource Record Set Resource Record>  - The resource records.
 - Set
Identifier string - An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
 - Traffic
Policy 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.
 
- 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 string
 PRIMARYorSECONDARY.- Geolocation
Get
Records 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 stringId  - ID of any applicable health check.
 - Multi
Value 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.
 - Resource
Records []GetRecords Resource Record Set Resource Record  - The resource records.
 - Set
Identifier string - An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
 - Traffic
Policy 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.
 
- 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 String
 PRIMARYorSECONDARY.- geolocation
Get
Records 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 StringId  - ID of any applicable health check.
 - multi
Value 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.
 - resource
Records List<GetRecords Resource Record Set Resource Record>  - The resource records.
 - set
Identifier String - An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
 - traffic
Policy 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.
 
- 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 string
 PRIMARYorSECONDARY.- geolocation
Get
Records 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 stringId  - ID of any applicable health check.
 - multi
Value 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.
 - resource
Records GetRecords Resource Record Set Resource Record[]  - The resource records.
 - set
Identifier string - An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
 - traffic
Policy 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
 PRIMARYorSECONDARY.- geolocation
Get
Records 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.
 
- alias
Target Property Map - Information about the AWS resource traffic is routed to.
 - cidr
Routing Property MapConfig  - Information about the CIDR location traffic is routed to.
 - failover String
 PRIMARYorSECONDARY.- geolocation Property Map
 - Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
 - geoproximity
Location Property Map - Information about how Amazon Route 53 responds to DNS queries based on the geographic origin of the query.
 - health
Check StringId  - ID of any applicable health check.
 - multi
Value 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.
 - resource
Records List<Property Map> - The resource records.
 - set
Identifier String - An identifier that differentiates among multiple resource record sets that have the same combination of name and type.
 - traffic
Policy 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      
- Dns
Name string - Target DNS name.
 - Evaluate
Target boolHealth  - Whether an alias resource record set inherits the health of the referenced AWS resource.
 - Hosted
Zone stringId  - Target hosted zone ID.
 
- Dns
Name string - Target DNS name.
 - Evaluate
Target boolHealth  - Whether an alias resource record set inherits the health of the referenced AWS resource.
 - Hosted
Zone stringId  - Target hosted zone ID.
 
- dns
Name String - Target DNS name.
 - evaluate
Target BooleanHealth  - Whether an alias resource record set inherits the health of the referenced AWS resource.
 - hosted
Zone StringId  - Target hosted zone ID.
 
- dns
Name string - Target DNS name.
 - evaluate
Target booleanHealth  - Whether an alias resource record set inherits the health of the referenced AWS resource.
 - hosted
Zone 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.
 
- dns
Name String - Target DNS name.
 - evaluate
Target BooleanHealth  - Whether an alias resource record set inherits the health of the referenced AWS resource.
 - hosted
Zone StringId  - Target hosted zone ID.
 
GetRecordsResourceRecordSetCidrRoutingConfig       
- Collection
Id string - The CIDR collection ID.
 - Location
Name string - The CIDR collection location name.
 
- Collection
Id string - The CIDR collection ID.
 - Location
Name string - The CIDR collection location name.
 
- collection
Id String - The CIDR collection ID.
 - location
Name String - The CIDR collection location name.
 
- collection
Id string - The CIDR collection ID.
 - location
Name string - The CIDR collection location name.
 
- collection_
id str - The CIDR collection ID.
 - location_
name str - The CIDR collection location name.
 
- collection
Id String - The CIDR collection ID.
 - location
Name String - The CIDR collection location name.
 
GetRecordsResourceRecordSetGeolocation     
- Continent
Code string - The two-letter code for the continent.
 - Country
Code string - The two-letter code for a country.
 - Subdivision
Code string - The two-letter code for a state of the United States.
 
- Continent
Code string - The two-letter code for the continent.
 - Country
Code string - The two-letter code for a country.
 - Subdivision
Code string - The two-letter code for a state of the United States.
 
- continent
Code String - The two-letter code for the continent.
 - country
Code String - The two-letter code for a country.
 - subdivision
Code String - The two-letter code for a state of the United States.
 
- continent
Code string - The two-letter code for the continent.
 - country
Code string - The two-letter code for a country.
 - subdivision
Code 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.
 
- continent
Code String - The two-letter code for the continent.
 - country
Code String - The two-letter code for a country.
 - subdivision
Code String - The two-letter code for a state of the United States.
 
GetRecordsResourceRecordSetGeoproximityLocation      
- Aws
Region 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
Get
Records Resource Record Set Geoproximity Location Coordinates  - Contains the longitude and latitude for a geographic region.
 - Local
Zone stringGroup  - An AWS Local Zone Group.
 
- Aws
Region 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
Get
Records Resource Record Set Geoproximity Location Coordinates  - Contains the longitude and latitude for a geographic region.
 - Local
Zone stringGroup  - An AWS Local Zone Group.
 
- aws
Region 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
Get
Records Resource Record Set Geoproximity Location Coordinates  - Contains the longitude and latitude for a geographic region.
 - local
Zone StringGroup  - An AWS Local Zone Group.
 
- aws
Region 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
Get
Records Resource Record Set Geoproximity Location Coordinates  - Contains the longitude and latitude for a geographic region.
 - local
Zone 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
Get
Records Resource Record Set Geoproximity Location Coordinates  - Contains the longitude and latitude for a geographic region.
 - local_
zone_ strgroup  - An AWS Local Zone Group.
 
- aws
Region 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.
 - local
Zone 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.