Skip to main content

Route53 Record

Provides a single Route53 Record.

Examples#

A Record#

Add an A record to the hosted zone:

const domainName = "your.domain.name.com";
const domain = await provider.useRoute53Domain({
name: domainName,
});
const hostedZoneName = `${domainName}.`;
const hostedZone = await provider.makeHostedZone({
name: hostedZoneName,
dependencies: { domain },
properties: ({}) => ({}),
});
const recordA = await provider.makeRoute53Record({
name: `${hostedZoneName}-ipv4`,
dependencies: { hostedZone, eip },
properties: ({ dependencies: { eip } }) => {
return {
Name: hostedZoneName,
Type: "A",
ResourceRecords: [
{
Value: eip.live?.PublicIp,
},
],
TTL: 60,
};
},
});

CNAME from a certificate#

Verify a certificate with DNS validation by adding a CNAME record.

const domainName = "your.domain.name.com";
const domain = await provider.useRoute53Domain({
name: domainName,
});
const hostedZone = await provider.makeHostedZone({
name: `${domainName}.`,
dependencies: { domain },
properties: ({}) => ({}),
});
const recordValidation = await provider.makeRoute53Record({
name: `validation-${domainName}.`,
dependencies: { hostedZone, certificate },
properties: ({ dependencies: { certificate } }) => {
const domainValidationOption =
certificate?.live?.DomainValidationOptions[0];
const record = domainValidationOption?.ResourceRecord;
if (domainValidationOption) {
assert(
record,
`missing record in DomainValidationOptions, certificate ${JSON.stringify(
certificate.live
)}`
);
}
return {
Name: record?.Name,
ResourceRecords: [
{
Value: record?.Value,
},
],
TTL: 300,
Type: "CNAME",
};
},
});

Source Code Examples#

Properties#

Dependencies#