Amplify - host two apps on a single domain?

0

I have a Vue js app running on a subdomain - app.domain.com. The homepage is simple html/css and I want to host it at www.domain.com

I want to keep these two projects separate as I am managing the Vue code, and someone else is handling the non-app pages using different technologies with different deployment schedules. Both are in their own git repo and I have set up two separate Amplify apps. I have already successfully set up the Vue application to point to the 'app' subdomain.

Trying to set the domain for the homepage Amplify application to www.domain.com tells me (correctly) that domain.com is in use with another Amplify app.

Any suggestions as to how I get around this? For example, can I put the two projects in the same repo, pointing one to app.domain.com and the other to www.domain.com?

Thanks

1 Answer
2
Accepted Answer

This is possible but I think you can not do it from GUI. I have 2 Amplify applications sharing the same domain; blog.carriageretun.nl and personal.carriagereturn.nl. You can read the full story from https://carriagereturn.nl/aws/amplify/static/web/hosting/2019/01/18/amplify.html

When you assign custom domain for your application, Amplify Console GUI will always want to take over the whole domain. I had carriagereturn.nl hosted on Route 53 and when I sliced a sub-domain blog.carriagereturn.nl, it wasn’t possible to assign it for app, but Amplify Console always register it as carriagereturn.nl. Work-a-round is use AWS CLI to assign a sub-domain for app. Here is an example from AWS Forum showing how to do this. Remember to replace ROOT_DOMAIN, SUB_DOMAIN, APP_ID and BRANCH with your application specific values.

aws amplify --region us-east-1 create-domain-association \
 --app-id APP_ID --domain-name ROOT_DOMAIN \
 --sub-domain-settings "[{\"prefix\": \"SUB_DOMAIN\",\"branchName\": \"BRANCH\"}]"
profile picture
EXPERT
Kallu
answered a year ago
profile picture
EXPERT
reviewed 9 months 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.

Guidelines for Answering Questions