Document1
Overview: You need to create a static website that prints the number of the types of files in
an S3 bucket. You will implement a Cloud9 app that will count the number of files in an S3
ucket for each file type (e.g., txt, xlsx). You will host the website within the same bucket
and it has an index and e
or page. Please see below the example screenshots of the index
page.
Example screen:
Details: The details of the assignment tasks are described below.
Part A: The static website (6 marks): You will use two HTML files - home.html and
invalid.html, as the index and e
or page, respectively. Assume that your S3 bucket consists
of files of different types – web, text, image, excel, and others. The index file will print a
count for each of these types. Existing files within an S3 bucket. You need to consider the
following types and respective file extensions.
• Web (.html)
• Text (.txt)
• Image (.jpg)
• Excel (.xlsx)
• Other (.pdf, .xml, etc.)
Remember to configure the bucket with the appropriate “bucket policy” and “public access”
for the public access of the website hosting. If you add or delete files in the bucket, the
index page must print an updated list based on the existing files in the bucket. The
invalid.html will be very simple and will display a relevant e
or message, e.g., “page not
found”. The e
or page appears upon entering the wrong/invalid URL.
Part B:
The Cloud9 app (24 marks): You might be wondering how it would be possible for a static
website to always display the cu
ent files of an S3 bucket. This is a dynamic behavior. You
need to implement a Cloud9 app that will do the following each time it runs.
(a) counting the number of each file type (use the file types mentioned above). You need to
write a separate method for listing objects and counting types.
(b) preparing html content for the ‘home.html’. The ‘home.html’ will contain information
about the file types and their counts. This information must be wrapped with HTML
formatted string. You will need a separate method for this feature.
(b) creating a new ‘home.html’ in the bucket, which will act as the index file for the website.
You will need a separate method for this feature.
You need to execute the Cloud9 app each time before running the website so that the index
page always displays the updated list of cu
ent file types and their counts.
Requirements: Your website and Cloud9 app must fulfill the following requirements.
• Your Cloud9 app must be named yourscuusernameA1App.
• You will use a single bucket for the whole assignment and its name must be
yourscuusernamea1-bucket.
• Your Cloud9 app must have three separate methods.
• Your Cloud9 app must use exception handling and loop(s).
• You must use AWS SDK v 2.x to implement the Cloud9 app.
• You need to add detailed comments inside your source code.