Using aws route53domains with us-east-1
TypeScriptTo utilize AWS Route 53 domain registration services with Pulumi, we will use the
aws.route53domains.RegisteredDomain
resource. This resource allows you to register a new domain name or transfer an existing one.In the example below, I will demonstrate how to register a new domain with Route 53 in the
us-east-1
region. We will also associate contact information with the domain, specify the auto-renewal setting, and enable transfer protection (often referred to as transfer lock).Note that specific contact details such as
techContact
,adminContact
, andregistrantContact
are required. In a real-world use case, you would need to replace these placeholders with actual contact information.For this example, we will also make use of the
aws.route53.Zone
resource to create a DNS hosted zone, which is necessary for managing DNS records for your registered domain.Here's the program written in TypeScript:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; // Register a new domain const myDomain = new aws.route53domains.RegisteredDomain("myDomain", { domainName: "example.com", autoRenew: true, transferLock: true, adminContact: { email: "admin@example.com", firstName: "Admin", lastName: "User", contactType: "PERSON", addressLine1: "123 Admin St", city: "Admin City", state: "Admin State", zipCode: "12345", countryCode: "US", phoneNumber: "+1.1234567890", }, registrantContact: { email: "registrant@example.com", firstName: "Registrant", lastName: "User", contactType: "PERSON", addressLine1: "123 Registrant St", city: "Registrant City", state: "Registrant State", zipCode: "12345", countryCode: "US", phoneNumber: "+1.1234567890", }, techContact: { email: "tech@example.com", firstName: "Tech", lastName: "User", contactType: "PERSON", addressLine1: "123 Tech St", city: "Tech City", state: "Tech State", zipCode: "12345", countryCode: "US", phoneNumber: "+1.1234567890", }, }); // Create a new Hosted Zone for the domain const myHostedZone = new aws.route53.Zone("myZone", { name: myDomain.domainName, comment: "Hosted zone managed by Pulumi", }); // Export the name servers of the created hosted zone to set them with the domain registrar export const nameServers = myHostedZone.nameServers;
In the above program:
- We register the domain
example.com
. Please replaceexample.com
with the domain you wish to register. - The specified contact objects (
adminContact
,registrantContact
, andtechContact
) represent individuals or organizations associated with the domain management. These must be provided accurately. - We set the domain to auto-renew and enable the transfer lock for added security.
- We create a Hosted Zone for DNS management and export the nameservers for use in delegation or to configure at your current domain registrar, if the domain is registered elsewhere.
Remember to replace the placeholder contact information with real contact details. Also, keep in mind that domain registration is not instantaneous, and the process might take some time to complete.
After deploying this Pulumi program, you will have registered a domain and created a Hosted Zone for it in AWS Route 53. The nameservers output can then be used to ensure your domain points to the right DNS records.
- We register the domain