DEV Community

Cover image for API Gateway and Cloud Front in the same domain with different path
Yaseen
Yaseen

Posted on

API Gateway and Cloud Front in the same domain with different path

This is a very useful feature where we can have both cloudfront and api gateway in the same domain.

Cloudfront has a beautiful feature of origins and behavior with which we can redirect to specific resource based on certain pattern.

This is in assumption that already api gateway and cloudfront is created along with route53 configurations.

Image description

First we will create origin for pointing to S3 bucket.

Image description

Save the configurations.

Later verify that we have new S3 origin.

Let's create another origin pointing to api gateway.

Image description

We now want to create the behavior and attach the origin to it.

Image description

We have successfully created the behaviour, default is pointing to S3 bucket.

You can also check https://kuchbhilearning.blogspot.com/2022/10/api-gateway-and-cloud-front-in-same.html

Top comments (0)