RecordArgs

data class RecordArgs(val aliases: Output<List<RecordAliasArgs>>? = null, val allowOverwrite: Output<Boolean>? = null, val cidrRoutingPolicy: Output<RecordCidrRoutingPolicyArgs>? = null, val failoverRoutingPolicies: Output<List<RecordFailoverRoutingPolicyArgs>>? = null, val geolocationRoutingPolicies: Output<List<RecordGeolocationRoutingPolicyArgs>>? = null, val healthCheckId: Output<String>? = null, val latencyRoutingPolicies: Output<List<RecordLatencyRoutingPolicyArgs>>? = null, val multivalueAnswerRoutingPolicy: Output<Boolean>? = null, val name: Output<String>? = null, val records: Output<List<String>>? = null, val setIdentifier: Output<String>? = null, val ttl: Output<Int>? = null, val type: Output<Either<String, RecordType>>? = null, val weightedRoutingPolicies: Output<List<RecordWeightedRoutingPolicyArgs>>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<RecordArgs>

Provides a Route53 record resource.

Example Usage

Simple routing policy

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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) {
var www = new Record("www", RecordArgs.builder()
.zoneId(aws_route53_zone.primary().zone_id())
.name("www.example.com")
.type("A")
.ttl(300)
.records(aws_eip.lb().public_ip())
.build());
}
}

Weighted routing policy

Other routing policies are configured similarly. See Amazon Route 53 Developer Guide for details.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.route53.Record;
import com.pulumi.aws.route53.RecordArgs;
import com.pulumi.aws.route53.inputs.RecordWeightedRoutingPolicyArgs;
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) {
var www_dev = new Record("www-dev", RecordArgs.builder()
.zoneId(aws_route53_zone.primary().zone_id())
.name("www")
.type("CNAME")
.ttl(5)
.weightedRoutingPolicies(RecordWeightedRoutingPolicyArgs.builder()
.weight(10)
.build())
.setIdentifier("dev")
.records("dev.example.com")
.build());
var www_live = new Record("www-live", RecordArgs.builder()
.zoneId(aws_route53_zone.primary().zone_id())
.name("www")
.type("CNAME")
.ttl(5)
.weightedRoutingPolicies(RecordWeightedRoutingPolicyArgs.builder()
.weight(90)
.build())
.setIdentifier("live")
.records("live.example.com")
.build());
}
}

Alias record

See related part of Amazon Route 53 Developer Guide to understand differences between alias and non-alias records. TTL for all alias records is 60 seconds, you cannot change this, therefore ttl has to be omitted in alias records.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.elb.LoadBalancer;
import com.pulumi.aws.elb.LoadBalancerArgs;
import com.pulumi.aws.elb.inputs.LoadBalancerListenerArgs;
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) {
var main = new LoadBalancer("main", LoadBalancerArgs.builder()
.availabilityZones("us-east-1c")
.listeners(LoadBalancerListenerArgs.builder()
.instancePort(80)
.instanceProtocol("http")
.lbPort(80)
.lbProtocol("http")
.build())
.build());
var www = new Record("www", RecordArgs.builder()
.zoneId(aws_route53_zone.primary().zone_id())
.name("example.com")
.type("A")
.aliases(RecordAliasArgs.builder()
.name(main.dnsName())
.zoneId(main.zoneId())
.evaluateTargetHealth(true)
.build())
.build());
}
}

NS and SOA Record Management

When creating Route 53 zones, the NS and SOA records for the zone are automatically created. Enabling the allow_overwrite argument will allow managing these records in a single deployment without the requirement for import.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.route53.Zone;
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) {
var exampleZone = new Zone("exampleZone");
var exampleRecord = new Record("exampleRecord", RecordArgs.builder()
.allowOverwrite(true)
.name("test.example.com")
.ttl(172800)
.type("NS")
.zoneId(exampleZone.zoneId())
.records(
exampleZone.nameServers().applyValue(nameServers -> nameServers[0]),
exampleZone.nameServers().applyValue(nameServers -> nameServers[1]),
exampleZone.nameServers().applyValue(nameServers -> nameServers[2]),
exampleZone.nameServers().applyValue(nameServers -> nameServers[3]))
.build());
}
}

Import

Route53 Records can be imported using ID of the record, which is the zone identifier, record name, and record type, separated by underscores (_)E.g.,

$ pulumi import aws:route53/record:Record myrecord Z4KAPRWWNC7JR_dev.example.com_NS

If the record also contains a set identifier, it should be appended

$ pulumi import aws:route53/record:Record myrecord Z4KAPRWWNC7JR_dev.example.com_NS_dev

Constructors

Link copied to clipboard
constructor(aliases: Output<List<RecordAliasArgs>>? = null, allowOverwrite: Output<Boolean>? = null, cidrRoutingPolicy: Output<RecordCidrRoutingPolicyArgs>? = null, failoverRoutingPolicies: Output<List<RecordFailoverRoutingPolicyArgs>>? = null, geolocationRoutingPolicies: Output<List<RecordGeolocationRoutingPolicyArgs>>? = null, healthCheckId: Output<String>? = null, latencyRoutingPolicies: Output<List<RecordLatencyRoutingPolicyArgs>>? = null, multivalueAnswerRoutingPolicy: Output<Boolean>? = null, name: Output<String>? = null, records: Output<List<String>>? = null, setIdentifier: Output<String>? = null, ttl: Output<Int>? = null, type: Output<Either<String, RecordType>>? = null, weightedRoutingPolicies: Output<List<RecordWeightedRoutingPolicyArgs>>? = null, zoneId: Output<String>? = null)

Properties

Link copied to clipboard
val aliases: Output<List<RecordAliasArgs>>? = null

An alias block. Conflicts with ttl&records. Documented below.

Link copied to clipboard
val allowOverwrite: Output<Boolean>? = null

Allow creation of this record to overwrite an existing record, if any. This does not affect the ability to update the record using this provider and does not prevent other resources within this provider or manual Route 53 changes outside this provider from overwriting this record. false by default. This configuration is not recommended for most environments. Exactly one of records or alias must be specified: this determines whether it's an alias record.

Link copied to clipboard

A block indicating a routing policy based on the IP network ranges of requestors. Conflicts with any other routing policy. Documented below.

Link copied to clipboard

A block indicating the routing behavior when associated health check fails. Conflicts with any other routing policy. Documented below.

Link copied to clipboard

A block indicating a routing policy based on the geolocation of the requestor. Conflicts with any other routing policy. Documented below.

Link copied to clipboard
val healthCheckId: Output<String>? = null

The health check the record should be associated with.

Link copied to clipboard

A block indicating a routing policy based on the latency between the requestor and an AWS region. Conflicts with any other routing policy. Documented below.

Link copied to clipboard

Set to true to indicate a multivalue answer routing policy. Conflicts with any other routing policy.

Link copied to clipboard
val name: Output<String>? = null

The name of the record.

Link copied to clipboard
val records: Output<List<String>>? = null

A string list of records. To specify a single record value longer than 255 characters such as a TXT record for DKIM, add \"\" inside the provider configuration string (e.g., "first255characters\"\"morecharacters").

Link copied to clipboard
val setIdentifier: Output<String>? = null

Unique identifier to differentiate records with routing policies from one another. Required if using cidr_routing_policy, failover_routing_policy, geolocation_routing_policy, latency_routing_policy, multivalue_answer_routing_policy, or weighted_routing_policy.

Link copied to clipboard
val ttl: Output<Int>? = null

The TTL of the record.

Link copied to clipboard
val type: Output<Either<String, RecordType>>? = null

The record type. Valid values are A, AAAA, CAA, CNAME, DS, MX, NAPTR, NS, PTR, SOA, SPF, SRV and TXT.

Link copied to clipboard

A block indicating a weighted routing policy. Conflicts with any other routing policy. Documented below.

Link copied to clipboard
val zoneId: Output<String>? = null

The ID of the hosted zone to contain this record.

Functions

Link copied to clipboard
open override fun toJava(): RecordArgs