Getting Started With Storage Simulation Instructions
Getting Started With Storage Simulation Instructions
Amazon S3
Simulation overview and objectives
In this simulation, you use some of the Amazon Simple Storage Service (Amazon S3)
features that you just learned about to create a static website.
Static websites can contain HTML pages, images, style sheets, and all files that are
needed to render a website. Static websites do not use server-side scripting or a
database. However, they might contain client-side scripts that run in a user's web
browser.
You can host a static website on Amazon S3 by uploading the content and making it
readable by users. No servers are needed, and you can use Amazon S3 to store and
retrieve any amount of data anytime from anywhere on the web.
Objectives
After completing this simulation, you will know how to do the following:
Duration
This simulation requires approximately 30 minutes to complete. You can take as long
as you need.
Prerequisites
Before you begin this simulation, you should complete the Getting Started with
Storage course content.
Amazon Web Services (AWS) service restrictions
In this simulation environment, you will be guided on which actions to perform.
Because this environment is not live, you can only perform the actions that you are
instructed to perform. If you choose any other actions, an error message will prompt
you to the right actions. It is highly recommended that you review How to use this
simulation in the introduction of the simulation.
1. In the AWS Management Console, choose the search bar and enter S3.
Note: To record your entry, press Enter on your keyboard or choose any place outside
the entry field.
An S3 bucket name is globally unique, and all AWS accounts share the namespace.
After you create a bucket, no other AWS accounts in any AWS Regions can use the
name of that bucket unless you delete the bucket.
Note: To record your entry, press Enter on your keyboard or choose any place outside
the entry field.
Public access to buckets is blocked by default. Because the files in your static website
must be accessible through the internet, you must permit public access.
8. For Block Public Access settings for this bucket, clear the checkbox for Block all
public access. Then, select the box that states I acknowledge that the current
settings might result in this bucket and the objects within becoming public.
9. Choose the scroll bar to scroll down to Bucket Versioning.
10. For Bucket Versioning, choose Enable.
Note: As soon as you turn on (enable) bucket versioning, you can't turn it off.
11. For Tags, choose Add tag, and enter the following:
o Key: Department
o Value: Marketing
Note: To record your entry, press Enter on your keyboard or choose any place outside
the entry field.
You can use tags to add additional information to a bucket, such as a project code,
cost center, or owner.
Your bucket appears in the list of buckets for your AWS account.
17. In the list of your buckets, choose the name of the bucket that you just created, sim-
website.
18. Choose the Properties tab.
19. Choose the scroll bar to scroll to the Static website hosting panel.
20. Choose Edit to the Static website hosting panel.
21. Choose Enable.
22. For Hosting type, keep the default setting Host a static website.
23. Configure the following settings:
o Index document: Enter index.html
o Error document: Enter error.html
Note: To record your entry, press Enter on your keyboard or choose any place outside
the entry field.
Note: You must enter index.html and error.html even though they are already
displayed. The display that you see is only an example of what the field is expecting.
A new tab opens where you receive a 403 Forbidden message because you have not
yet configured the bucket permissions. You can return to it later.
22. Choose the scroll bar to scroll to the top of the page, and choose the Objects tab.
23. Choose Upload.
24. Choose Add files.
25. Choose the Website files folder, and choose Open to open the folder.
26. Use your mouse to choose each of the following files: index.html, script.js, and
style.css (order does not matter). Then choose Open.
27. Choose the scroll bar to scroll down.
28. Choose Upload.
You have successfully uploaded your website file to your sim-website bucket.
28. Return to the browser tab that showed the 403 Forbidden message.
29. Choose the Refresh button for the webpage.
You should still see a 403 Forbidden message. This response is expected. This
message indicates that your static website is being hosted by Amazon S3 but that the
content is private.
• To make either a whole bucket public or a specific directory in a bucket public, use a
bucket policy.
• To make individual objects in a bucket public, use an access control list (ACL).
30. Keep the website tab open, and return to the web browser tab with the Amazon S3
console.
31. Choose the Name checkbox to select all three objects.
32. In the Actions menu, choose Make public using ACL.
You should now see the static website that Amazon S3 is hosting.
Now you know how to share objects with everyone by making them public. However,
at times, you might need to share an individual object for a limited amount of time. In
the next task, you learn how to temporarily share an object.
Task 5: Securely sharing an object by using a
presigned URL
When you must temporarily and securely share an object with a person or group of
people, you can create a presigned URL. When you create the URL, you must
configure how long the URL will be valid. Then, you can share this URL with the users
who should have access to the object.
If the presigned URL is valid, anyone who has it can get to the object. Avoid keeping
the URL active longer than necessary, and only share the URL with people you trust.
Like when you first uploaded the website files, the new-report.png file is private by
default. This time, instead of making the object public, you create a presigned URL to
access the file.
Note: To record your entry, press Enter on your keyboard or choose any place outside
the entry field.
If you wait 2 minutes and use the link again, you will find that the URL has expired
and no longer works. Note: for the sake of the simulation, you do not need to wait 2
minutes.
Now that the presigned URL is expired, you get an Access denied page.
{
"Version": "2012-10-17",
"Id": "MyBucketPolicy",
"Statement": [
{
"Sid": "BucketPutDelete",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:DeleteObject",
"Resource": [
"arn:aws:s3:::sim-website/index.html",
"arn:aws:s3:::sim-website/script.js",
"arn:aws:s3:::sim-website/style.css"
]
}
]
}
This policy prevents everyone from deleting the three files that make your website
work.
Note: If you use this code in your own AWS account, you must use the name of your
bucket in place of this simulation’s sim-website bucket.
Note: To record your entry, press Enter on your keyboard or choose any place outside
the entry field.
This entry confirms that your policy is working and preventing the website's files from
being deleted.
Your bucket policy is now protecting your website files from being deleted.
62. On your computer, load the index.html file into a text editor (in this simulation, you
use Notepad). Follow these specific steps:
1. Open the context (right-click) menu for the index.html file.
2. Choose Open with.
3. Choose Notepad.
63. Find the text Served from Amazon S3, and replace it with Created by Jane . Follow
these specific steps:
1. Choose the text Served from Amazon S3.
2. Enter Created by Jane .
Note: To record your entry, press Enter on your keyboard or choose any place outside
the entry field.
66. Choose the index.html file name (choose the link, not the checkbox).
67. Choose the Object URL link.
Served from Amazon S3 should still be visible on your website page because you have
not yet uploaded the new version and made it public. Next, you will upload the
index.html file that you edited and make it public.
68. Choose the Back arrow on your browser to return to the Amazon S3 console.
69. Choose the sim-website link from the navigation at the top of the page.
70. Upload the index.html file that you just edited. Follow these specific steps:
1. Choose Upload.
2. Choose Add files.
3. Choose the Website files folder, and choose Open.
4. Choose the index file and choose Open.
5. Choose the scroll bar to scroll down.
6. Choose Upload.
7. Choose Close.
71. Select the index.html checkbox, and in the Actions menu, choose the Make public
using ACL option again.
72. Choose Make public, and choose Close.
Now you verify that your website is updated with your edits.
73. Choose the index.html file name (choose the link, not the checkbox).
74. Choose the Object URL link.
Created by Jane should now be on the page in place of Served from Amazon S3.
Your static website is now accessible on the internet. Because it is hosted on Amazon
S3, the website has high availability and can serve high volumes of traffic without
using any servers.
75. Choose the Back arrow on your browser to return to the Amazon S3 console.
76. Choose the sim-website link from the navigation at the top of the page.
However, when versioning is turned on, changed and deleted versions of files are
saved. Previous versions of objects are not presented by default, but you can access
them by using the console or programmatically. Because you are keeping earlier
versions of objects, you can recover them if you need to.
It is important to remember that as soon as you turn on versioning, you cannot turn it
off. However, you can suspend versioning. For more information about bucket
versioning, see “Using versioning in S3 buckets” in the Amazon Simple Storage
Service Users Guide at
https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html.
Recall that when you created your bucket, you turned on versioning. In this task, you
view the object versions available in your bucket.
77. Choose Show versions to see which files have multiple versions.
78. Choose the scroll bar to scroll down.
79. Review the list of objects in the bucket.
o Notice that each file has a Version ID. Amazon S3 automatically generates these
IDs when versioning is turned on.
o You should also find two versions of the index.html file because you uploaded a
new version of the file. The current version is the file that you uploaded when you
updated your website.
Summary
In this simulation, you created a personalized, publicly accessible, static website. You
learned how to use a presigned URL to temporarily share objects in your bucket. You
also protected your work with a bucket policy that prevents file deletion, and you
turned on bucket versioning to recover previous versions of files. Excellent work!
Simulation complete
Congratulations! You have completed the simulation.
©2024 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may
not be reproduced or redistributed, in whole or in part, without prior written
permission from Amazon Web Services, Inc. Commercial copying, lending, or selling is
prohibited.