Closed chrisbonifacio closed 6 months ago
The Amplify Console UI shows it's coming soon
It would be great if there's a CDK-based solution for this as a workaround.
you can use
aws amplify create-domain-association --app-id
https://docs.aws.amazon.com/cli/latest/reference/amplify/create-domain-association.html
Command to get your app-id aws amplify list-apps
Command to create custom domain
aws amplify create-domain-association --app-id=d1b61z****l79 --domain-name=example.co.uk --sub-domain-settings prefix=,branchName=main
Custom domain support for Amplify Gen 2 apps is currently in development and is not available as part of the preview. That being said, as stated in this thread you can add custom domains to your Gen 2 apps using the AWS CLI/API/SDK.
To add a custom domain, you can use the create-domain-association API:
aws amplify create-domain-association --app-id <VALUE> --domain-name <VALUE> --sub-domain-settings prefix=<VALUE>,branchName=<VALUE>
To retrieve the required dns records, you can use the get-domain-association API:
aws amplify get-domain-association --app-id <VALUE> --domain-name <VALUE>
Also, you can add wildcard subdomains on the app by modifying the prefix
attribute as follows:
aws amplify create-domain-association --app-id <VALUE> --domain-name <VALUE> --sub-domain-settings prefix=\*,branchName=<VALUE>
As @Jay2113 called out, Custom domain support in Gen2 is work in progress. We will update this ticket in next few weeks as soon as its released in production. Stay tuned!
Will be waiting 😏
Can't wait for GA. Any tentative date for GA?
As @Jay2113 called out, Custom domain support in Gen2 is work in progress. We will update this ticket in next few weeks as soon as its released in production. Stay tuned!
@Milan-Shah What is the approximate release time? I am also trying to deploy my new project with Gen 2, looking forward to the official release.
Thanks @Jay2113 !
How can I create a domain association for the domain apex?
any news?
I share my code to create the association via CDK. Maybe it can be helpful for someone who wants to keep tracks
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { aws_amplify as amplify } from 'aws-cdk-lib';
export class AmplifyDomainStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const cfnDomain = new amplify.CfnDomain(this, 'WebsiteAmplifyCfnDomain', {
appId: 'your-app-id',
domainName: 'domain.com',
subDomainSettings: [{
branchName: 'main',
prefix: '',
}],
});
}
}
We are getting a 404 accessing our custom domain after creating the association via CDK. The response headers include
X-Cache: Error from cloudfront
Custom domain feature seems to be live on the console.
Custom domain feature seems to be live on the console.
@ideen1 What region? Is it for new or existing deployment? I'm still seeing 'Coming Soon'
@rosswickman Oh that is interesting. It may be a gradual rollout. I am seeing this in ca-central-1 on an existing app.
@ideen1 I have it now!!!
This is now available.
Can you provide an example of how to do it via the native amplify CDK
Environment information
Description
I would like to be able to deploy my Gen 2 application to a custom domain