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

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay