I am relatively new to AWS, but recently I managed to get a static site running through S3 and access to Lambda features, so itβs very fresh in my mind.
First of all, there is no way to direct specific domain paths to specific AWS resources. So, if you use Route 53 to point your domain to the S3 bucket to serve static resources, all paths of this domain will try to retrieve resources only in this S3 bucket. Now, since your backend also serves static files from the S3 bucket, it could technically be in the same S3 bucket as for the / / just saved in the backend folder, if appropriate.
Otherwise, the real answer is to use subdomains.
With this concept, you can do the following:
- www.yourdomain.com point to S3, which contains a static site for "/"
- api.yourdomain.com points to the AWS API Gateway, which can act as a proxy to access your lambda functions
- backend.yourdomain.com points to an S3 bucket for your "/ backend" site if necessary
You can simply add entries to your zone for your domain to create subdomains. See the documentation here .
Getting all of this setup is beyond the scope of this question and will be a way for a long one, but hopefully this information makes sense and helps lead you in a direction that makes more sense.
source share