Skip to content

Amplify Branch Subdomains Points to Same CloudFront Distribution

0

I’m currently deploying an app on AWS Amplify with two branches, "main" and "staging". Each branch is set up with its own Amplify deployment, and they have different Amplify URLs. However, when I add subdomains (app for main and app-staging for staging) under my custom domain, both subdomains (app.mydomain.com and app-staging.mydomain.com) end up pointing to the same CloudFront distribution URL. The solution proposed by the documents is to ceate unique CloudFront distributions for each branch, and listed where to access the cloudfront setting in amplify. The problem is, they are based on the old UI, the new amplify UI no longer has access to the cloudfront settings. So where should I find the cloudfront settings for my amplify app? What is the solution for my problem?

1 Answer
0

The issue you're experiencing with AWS Amplify where both subdomains point to the same CloudFront distribution is not typical behavior. Normally, Amplify should create separate CloudFront distributions for different branches, especially when they are set up with different subdomains.

Unfortunately, the new Amplify UI has indeed changed, and the direct access to CloudFront settings that was available in the old UI is no longer present. However, this doesn't mean you can't solve the problem. Here are a few steps you can try:

  1. First, double-check your domain management settings in the Amplify console. Ensure that you have correctly set up the custom domain and subdomains for each branch.

  2. If the domain settings look correct, you may need to reach out to AWS Support. They can help you investigate why both subdomains are pointing to the same CloudFront distribution, as this is not the expected behavior.

  3. As a workaround, you could consider using the AWS CloudFront console directly to manage your distributions. While Amplify typically handles this automatically, you might be able to create separate distributions manually and associate them with your Amplify deployments.

  4. Another option is to use the AWS CLI or AWS SDKs to interact with the CloudFront API. This would allow you to view and potentially modify the CloudFront settings associated with your Amplify app.

  5. If you're comfortable with more advanced configurations, you could explore using AWS CDK integration with Amplify. This would give you more fine-grained control over the resources created by Amplify, including CloudFront distributions.

Remember, Amplify is designed to handle these configurations automatically, so if you're experiencing this issue, it's likely a configuration problem or a potential bug. Don't hesitate to contact AWS Support for assistance, as they can provide more specific guidance based on your account and app setup.

Sources
AWS Amplify | Extensible Web & Mobile Apps | Amazon Web Services
New in AWS Amplify: Expanded Fullstack Deployment Capabilities for Teams of All Sizes | Front-End Web & Mobile

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.