Search code examples
dnsamazon-ecsaws-amplify

How to configure domain name if frontend running on aws amplify and backed running on AWS fargate


I have a domain name already i.e test.com

I have created a new web application using reactjs and django

I have Setup the reactjs application on AWS amplify and i got the public aws url. front.aws.url.com

I have Setup the django application on AWS ECS fargate and i got the public aws url through ALB as backend.aws.url.com

Now i want to use my already existing domain name and put these in a new path

eg:

frontend will be on test.com/testing

and backend apis are called at test.com/testing/api/

How can i do this in aws


Solution

  • frontend will be on test.com/testing

    and backend apis are called at test.com/testing/api/

    In order to have them both on the same domain name, with different paths, you would have to place a proxy in front of them that handles the mapping of different paths to different servers, and also does path rewriting. In AWS you would have to create a CloudFront distribution, configure the custom domain name, and configure multiple origins.


    It is generally much easier, and much more flexible, to use multiple subdomains for front-end and back-end, like:

    frontend: test.com

    backend: api.test.com