GithubHelp home page GithubHelp logo

aws-static-hosting's Introduction

Project - Static Website Hosting on AWS

The purpose of this project is to host a static website on AWS using S3 and CloudFront.

Rubric Points

Below is an outline of how the rubric points have been addressed.

Website Files


Note: The steps in this project have been completed entirely using aws cli.

The student has created a S3 bucket.

And S3 bucket is created with public read access:

aws s3api create-bucket --bucket 8e45017a-5591-40db-bacd-d247ead45df0 --acl public-read

s3-bucket

All website files should be added to the S3 bucket.

The static website files are extracted to the folder called files. They are uploaded to the previously created AWS bucket.

aws s3 sync files/ s3://8e45017a-5591-40db-bacd-d247ead45df0

s3-files

The bucket configuration should be set up to support static website hosting.

The website is set up for static website hosting using the following command, specifying the index and error documents (both direct to index.html):

aws s3 website s3://8e45017a-5591-40db-bacd-d247ead45df0/ --index-document index.html --error-document index.html

s3-hosting

The permission access to the bucket should be configured.

A JSON policy file (policy.json) is created with the following content:

{
"Version":"2012-10-17",
"Statement":[
 {
   "Sid":"AddPerm",
   "Effect":"Allow",
   "Principal": "*",
   "Action":["s3:GetObject"],
   "Resource":["arn:aws:s3:::8e45017a-5591-40db-bacd-d247ead45df0/*"]
 }
]
}

The policy.json file is used to set the bucket policy:

aws s3api put-bucket-policy --bucket 8e45017a-5591-40db-bacd-d247ead45df0 --policy file://policy.json

s3-permissions


Website Distribution

The website should be distributed via Cloudfront.

A CloudFront distribution is created for the website:

aws cloudfront create-distribution --origin-domain-name 8e45017a-5591-40db-bacd-d247ead45df0.s3-website-us-east-1.amazonaws.com --default-root-object index.html

cloudfront


Web Browser Access

Is the website publicly accessible?

The website is accessible via the following url's:

cloudfront-access

s3-access

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.