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개 답변
2
수락된 답변

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
전문가
Kallu
답변함 일 년 전
profile picture
전문가
검토됨 10달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠