0% found this document useful (0 votes)
39 views3 pages

ICT507 Week 9 Lab 4 - 6 Marks

Uploaded by

Arsalan Chaudhry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

ICT507 Week 9 Lab 4 - 6 Marks

Uploaded by

Arsalan Chaudhry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab 9 - Host a Sta c Website on AWS S3:

Create Bucket:

1. Search for the S3 service and navigate to the S3 dashboard.


2. Click on the Create Bucket bu on to configure and create a new bucket. Bucket Name
should be your first name – your last name.
3. The first thing to do on the bucket configura on screen is to give your bucket a globally
unique name. S3 will prevent you from crea ng a bucket if the name is already taken. Select
a preferred region for your bucket or leave the region selected by default. Also, leave the
“Object Ownership” sec on as default.
4. To host sta c websites on S3, you need to make the bucket publicly available. So in the next
step, uncheck the Block all public access op on. Then acknowledge in the warning prompt
that comes up below it that you agree to make it public. Bucket versioning is not required, so
you should disable it.
5. The last 3 steps don’t necessarily need ac on from you. You can add tags if you want, like the
sample tag here which is “descrip on”. Keep the default encryp on disabled and click on the
Create Bucket bu on to create your new bucket.

Configure the new S3 bucket for sta c web hos ng

1. Click on the bucket name in the S3 dashboard and, on the new screen that loads, navigate to
the Proper es tab.
2. Scroll down to the Sta c website hos ng sec on and click on the Edit bu on. This will open
the sta c website hos ng configura on screen.
3. Enable it and leave the Hos ng type as default. A note on this screen says: “For your
customers to access the content at the website endpoint, you must make all your content
publicly readable…”. This is why it was necessary to allow public access when crea ng the
bucket earlier.
4. The Index document field is where you specify your website’s index file which is usually
index.html. The Error document is the page you want to display whenever an error occurs,
such as a 404 error.
5. Save changes and return to the proper es screen. You should no ce a new Bucket website
endpoint in the Sta c website hos ng sec on. You’ll be able to use this URL to access your
website once you’ve finished se ng it up.

You now have your bucket configured and ready to host a sta c website. How then do you add your
website files to the bucket and view your website?

How to Upload Files and Folders to an S3 Bucket

1. Make a customized index.html page with references to at least two jpeg images.
2. To host your sta c website in the cloud on S3, you need to upload your files and folders to
the configured S3 bucket. Navigate back to the objects tab and click any of the upload
bu ons to upload your website files.
3. The next screen is where you can add the files and folders you want to upload to the bucket.
Ensure you add your index.html file and every other file or folder associated with your
website here. The folders you might want to add are your CSS, JavaScript, and image folders.
4. You can add files and folders either by drag and drop or by using the “Add files” or “Add
folders” bu on. Once you have added all files and folders, click the upload bu on at the end

of the screen. Wait for the files to upload, and then you can click the close bu on to return
to the "Objects" screen.

How to Secure and Preview the Deployed Website

At this stage, we’re almost done, and the website is almost ready for preview in a browser. The site
can’t open yet due to Amazon’s Iden ty and Access Management policies that prevent access to
resources in a bucket.

You need to allow access to the bucket's resources yourself.

1. Navigate to the permissions tab on the bucket dashboard and edit the Bucket policy.
2. Copy and paste the code below and replace “website-name” with your bucket’s
name.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your bucket name/*"
}
]
}

3. Save changes and revisit the proper es tab once again to get the website URL from the
sta c website sec on.
4. Copy and paste the URL into a browser, and you’ll see your sta c website. (Take a
screenshot and submit it via Moodle) – 5 marks
Sample Index.html file

<html xmlns="http://www.w3.org/1999/xhtml" >


<head>
<title>My Website Home Page - Hamid Salarian</title>
</head>
<body>
<h1>Welcome to my website - Hamid Salarian</h1>
<p>Now hosted on Amazon S3!</p>
<p><img src="your image name" alt="Table"></p>

</body>
</html>

You might also like