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
回答済み 1年前
profile picture
エキスパート
レビュー済み 10ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ