gmailDomain
View SourceGmail custom domain configuration enables using your own domain (like mail@yourcompany.com) with Gmail/Google Workspace email services. This component creates the necessary DNS records in Route53 for domain verification and email routing to Google’s mail servers.
import * as saws from "@stackattack/aws";
const ctx = saws.context();const gmailSetup = saws.gmailDomain(ctx, { domain: "mail.example.com", verificationCode: "google-site-verification=abc123..."});
export const mxRecord = gmailSetup.id;
After deployment, complete the Gmail/Google Workspace setup:
-
In Google Admin Console (for Google Workspace):
- Add your domain and verify ownership
- Configure user accounts with your custom domain
- Set up email routing and aliases
-
Verify DNS propagation:
Terminal window # Check MX recordsdig MX mail.example.com# Verify TXT record for domain verificationdig TXT mail.example.com# Test email deliverynslookup -q=MX mail.example.com -
Configure email clients:
- IMAP: imap.gmail.com:993 (SSL)
- SMTP: smtp.gmail.com:587 (TLS)
- Use your custom domain email address and Google account password
Gmail custom domain setup through AWS Route53 has minimal infrastructure costs:
- Route53 hosted zone: $0.50/month per domain
- DNS queries: $0.40 per million queries (typically <$1/month)
- Google Workspace: $6-$18/user/month (separate Google billing)
- Domain registration: Varies by registrar and TLD
This approach is cost-effective for small to medium businesses wanting professional email addresses without managing email servers. The primary cost is the Google Workspace subscription, not the AWS infrastructure.
gmailDomain
Section titled “gmailDomain”Creates Route53 DNS records to configure a custom domain for Gmail/Google Workspace.
function gmailDomain(ctx: Context, args: GmailDomainArgs): Record
Parameters
Section titled “Parameters”ctx
(Context
) - The context for resource naming and taggingargs
(GmailDomainArgs
) - Configuration arguments for the Gmail domain setup
Returns
Section titled “Returns”- (
Record
) - Creates Route53 DNS records to configure a custom domain for Gmail/Google Workspace.
Interfaces
Section titled “Interfaces”GmailDomainArgs
Section titled “GmailDomainArgs”Configuration arguments for setting up Gmail domain verification and MX records.
Properties
Section titled “Properties”domain
(Input<string>
) - The domain name to configure for GmailnoPrefix?
(boolean
) - Whether to skip adding a prefix to the resource nameverificationCode?
(Input<string>
) - Google verification code for domain ownership. If not passed, no verification record will be created for the domainzoneId?
(Input<string>
) - Route53 zone ID (auto-detected from domain if not provided)