Custom Domain Setup
Configure a custom domain for your AI SaaS platform
Custom Domain Setup
Setting up a custom domain for your AI SaaS platform enhances your brand identity and provides a more professional appearance. This guide walks you through configuring a custom domain for your AWS Amplify application.
Prerequisites
Before setting up a custom domain, ensure you have:
- A registered domain name (through AWS Route 53 or another domain registrar)
- Access to manage DNS records for your domain
- Successfully deployed your application and verified all functionality
Using a domain registered through AWS Route 53 simplifies the process, but you can use any domain registrar.
Setting Up a Custom Domain with AWS Amplify
Access AWS Amplify Console
- Go to the AWS Management Console
- Navigate to "AWS Amplify"
- Select your application
Add Custom Domain
- Click on the "Domain management" tab
- Click "Add domain"
- Enter your root domain (e.g.,
yourdomain.com
) - Click "Configure domain"
Choose Subdomains
-
Configure the subdomains you want to use:
- Root domain:
yourdomain.com
(typically mapped towww
) - Subdomain:
www.yourdomain.com
(typically mapped tomain
branch)
- Root domain:
-
Click "Save"
You can add additional subdomains if needed, such as app.yourdomain.com
or docs.yourdomain.com
.
Verify Domain Ownership
For domains not on Route 53:
- Amplify will generate DNS records that you need to add to your domain registrar
- Add these records through your domain registrar's DNS management console
- Wait for DNS verification (can take up to 48 hours, but often completes within an hour)
For domains on Route 53:
- Amplify can automatically add the required DNS records
- Simply approve the changes when prompted
Verify SSL Certificate
AWS Amplify automatically provisions an SSL certificate for your domain through AWS Certificate Manager (ACM).
- On the Domain management page, wait for the SSL certificate status to change to "Available"
- This process may take up to 24 hours, but often completes within an hour
Your custom domain won't work until the SSL certificate is provisioned and the DNS records have propagated.
Update OAuth and Stripe Configurations
After setting up your custom domain, you need to update your OAuth and Stripe configurations to use the new domain.
Update Google OAuth Configuration
- Go to the Google Cloud Console
- Navigate to "APIs & Services" > "Credentials"
- Click on your OAuth 2.0 Client ID
- Add your custom domain to Authorized JavaScript origins:
https://yourdomain.com
https://www.yourdomain.com
- Click "Save"
Update Cognito App Client
- Go to the AWS Cognito console
- Select your user pool
- Go to "App integration" > "App clients and analytics"
- Select your app client
- Add your custom domain URLs to:
- "Allowed callback URLs"
- "Allowed sign-out URLs"
- Click "Save changes"
Update Stripe Webhooks (If Necessary)
If you've set up a custom domain for your API Gateway:
- Log in to the Stripe Dashboard
- Go to "Developers" > "Webhooks"
- Click on your webhook endpoint
- Update the webhook URL to your custom domain
- Click "Update endpoint"
Final Verification
After setting up your custom domain, perform a final verification to ensure everything is working correctly:
Access Your Site via Custom Domain
- Open a browser and navigate to your custom domain
- Verify that your application loads correctly
- Check that the SSL certificate is valid (look for the lock icon in your browser)
Test Authentication
- Sign out if you're already logged in
- Test both email and Google sign-in to ensure they work with your custom domain
Test Stripe Integration
Make a test subscription purchase to verify that redirects to and from Stripe work correctly with your custom domain.
Congratulations!
You've now completed the entire setup, configuration, and verification process for your AI SaaS platform. Your application is fully functional, properly integrated with third-party services, and optionally configured with a professional custom domain.