How to create cloudfront distribution for a static website hosted in AWS S3 ?

How to create cloudfront distribution for a static website hosted in AWS S3 ?

June 23, 2020 / Nirav Shah

Ever wondered how you can host a static website using Amazon S3? and serve it via CloudFront CDN. Follow along with us to know more about it.

Step 1

  • Create a CloudFront web distribution. In addition to the distribution settings that you need for your use case, enter the following.
    • For Origin Domain Name, select the bucket that you created.
    • For Restrict Bucket Access, select Yes.
    • For Origin Access Identity, select Create a New Identity.
    • For Comment, you can choose to keep the default value. Or, you can enter a custom label for the OAI.
    • For Grant Read Permissions on Bucket, select Yes, Update Bucket Policy.

Step 2

  • If you don’t want to use SSL (HTTPS) for your website, proceed to the next step. To use SSL for your website, for SSL Certificate, you can select the Default CloudFront Certificate or a Custom SSL Certificate. Or, you can choose Request or Import a Certificate with ACM to request a new certificate. Important: If you entered Alternate Domain Names (CNAMEs) for your distribution, the CNAMEs must match the SSL certificate that you select. For more information, see Using Alternate Domain Names and HTTPS.
  • Note: If you don’t have a domain to point the cloudfront please skip the Custom SSL Certificate and select Default CloudFront Certificate.

Step 3

  • Choose to Create Distribution.

Step 4

  • The distribution will go in In Progress mode wait until the distribution is deployed state.
  • Now copy the domain looking like example.cloudfront.net and point to you domain and will start working ( optional ) you can also run the website on example.cloudfront.net

Talk to AWS Certified Consultant

    Spread Love By Sharing:

    Let Us Talk About Your AWS Development Requirements

    Have queries about your AWS project ideas and concepts? Please drop in your project details to discuss with our AWS experts, professionals and consultants.

    • Swift Hiring and Onboarding
    • Experienced and Trained AWS Team
    • Quality Consulting and Programming
    Let’s Connect and Discuss Your Project