16
votes

I want to:

  • Distribute the static part of the website (html, css, js) on my domain www.example.com.
  • Put API Gateway services on my domain under a folder, www.example.com/v1.

How do I accomplish this?

In route 53, from what I understand I can only point to one cloudfront distribution, so I am choosing my S3/CloudFront enabled bucket.

So, the end result should be, in order of priority/mapping:

  • www.example.com/v1/* <-> API Gateway <-> Lambda <-> DynamoDB
  • www.example.com/* <-> CloudFront <-> S3 bucket contents

In what way can I achieve this? And if not, what are my alternatives since I need to bend to the same origin principle requirement in web browsers.

1

1 Answers

18
votes

You would setup CloudFront with two origins, S3 and API Gateway, and configure CloudFront to use the API Gateway origin for all requests that start with /v1