Skip to content

Record

Source: src/AWS/Route53/Record.ts

A Route 53 DNS record set.

Record manages a single Route 53 record set using UPSERT for create and update operations, and waits for Route 53 change propagation before returning.

A Record Alias To CloudFront

const record = yield* Record("WebsiteAlias", {
hostedZoneId: "Z1234567890",
name: "www.example.com",
type: "A",
aliasTarget: {
hostedZoneId: distribution.hostedZoneId,
dnsName: distribution.domainName,
},
});

TXT Record

const record = yield* Record("VerificationRecord", {
hostedZoneId: "Z1234567890",
name: "_acme-challenge.example.com",
type: "TXT",
ttl: 60,
records: ["\"value\""],
});

Weighted Routing

const blue = yield* Record("Blue", {
hostedZoneId: zone.id,
name: "api.example.com",
type: "A",
ttl: 60,
records: ["1.2.3.4"],
setIdentifier: "blue",
weight: 90,
});
const green = yield* Record("Green", {
hostedZoneId: zone.id,
name: "api.example.com",
type: "A",
ttl: 60,
records: ["5.6.7.8"],
setIdentifier: "green",
weight: 10,
});

Failover Routing With Health Check

const primary = yield* Record("Primary", {
hostedZoneId: zone.id,
name: "app.example.com",
type: "A",
ttl: 60,
records: ["1.2.3.4"],
setIdentifier: "primary",
failover: "PRIMARY",
healthCheckId: healthCheck.id,
});
const secondary = yield* Record("Secondary", {
hostedZoneId: zone.id,
name: "app.example.com",
type: "A",
ttl: 60,
records: ["5.6.7.8"],
setIdentifier: "secondary",
failover: "SECONDARY",
});

Latency Routing

const record = yield* Record("UsEast", {
hostedZoneId: zone.id,
name: "api.example.com",
type: "A",
ttl: 60,
records: ["1.2.3.4"],
setIdentifier: "us-east-1",
region: "us-east-1",
});

Geolocation Routing

const record = yield* Record("Default", {
hostedZoneId: zone.id,
name: "www.example.com",
type: "A",
ttl: 60,
records: ["1.2.3.4"],
setIdentifier: "default",
geoLocation: { countryCode: "*" },
});