Skip to content

Records

Source: src/AWS/Route53/Records.ts

A dynamic set of identically-configured Route 53 records that differ only by name.

Unlike Record (one resource per record), Records reconciles a whole name set against the hosted zone — names added to the set are upserted, names removed from the set are deleted. The set is the union of the declared names prop and names contributed through the RecordsBinding binding contract, which is how composites (e.g. a site attached to an AWS.Website.Router) register hostnames on a distribution’s DNS without a circular input prop.

Alias Records For Several Hostnames

const records = yield* Records("AliasRecords", {
hostedZoneId: "Z1234567890",
type: "A",
names: ["www.example.com", "docs.example.com"],
aliasTarget: {
hostedZoneId: distribution.hostedZoneId,
dnsName: distribution.domainName,
},
});

Binding Target For Composite-Contributed Names

// Names may also arrive through the binding contract — an
// `AWS.Website.Router` declares an empty set and attached sites bind
// their hostnames onto it:
const records = yield* Records("SiteAliasRecords", {
hostedZoneId: "Z1234567890",
type: "A",
aliasTarget: {
hostedZoneId: distribution.hostedZoneId,
dnsName: distribution.domainName,
},
});
// elsewhere:
yield* records.bind`MySite`({ names: ["docs.example.com"] });