DEV Community

Tim Nguyen
Tim Nguyen

Posted on

CloudFront + S3 + Static domain routing

What are existing:

  • S3 bucket 1: xxx.s3.us-east-1.amazonaws.com
  • S3 bucket 2: yyy.s3.us-east-1.amazonaws.com
  • Domain name: abc.com

What is requiring:

  • Using only 1 static domain name: static.abc.com
  • Using only 1 CloudFront distribution to serve both S3 buckets above with prefix (S3 bucket 1 - prefix admin and S3 bucket 2 - prefix public)
  • Eg: What is served with https://xxx.s3.us-east-1.amazonaws.com/img.jpg can be served with https://static.abc.com/admin/img.jpg and what is served with https://yyy.s3.us-east-1.amazonaws.com/img.png can be served with https://static.abc.com/public/img.png

Idea

  • Create a distribution in CloudFront with 2 origins are 2 bucket above
  • Create 3 distribution behaviors:
    • /admin/* - To Distribution's Origin of S3 Bucket 1
    • /public/* - To Distribution's Origin of S3 Bucket 2
    • Default(*) - To either Origin of S3 Bucket 1 or Origin of S3 Bucket 2
  • Modify 3 distribution behaviors to have function associations to Lambda@Edge function (this will be in another post, but the document for create one here)

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)