P. Johnson
P. Johnson

Reputation: 3

Can I link an AWS CloudFront distribution to an S3 bucket, and have one folder path direct to an EC2 instance?

(warning, I'm an AWS rookie) I have an S3 bucket set up for static web page hosting, and an Elastic Beanstalk (php) instance available through an EC2 instance.

What I'd like to do with a CloudFront distribution///

Everything under: http://(cloudfront_domain)/* is ditrected to the S3 bucket,

-except-

everything under: http://(cloudfront_domain)/one_folder/* is directed to the EC2 instance

Upvotes: 0

Views: 337

Answers (1)

Ashan
Ashan

Reputation: 19738

This is possible by adding the EC2 instance as an origin (Use EC2 instance Public DNS) and creating a Cache Behavior with a Path Pattern routing that /one_folder* to the EC2 origin.

For more complex routing rules, you can also consider using Lambda@Edge.

Upvotes: 1

Related Questions