manishawsdevops / aws-devops-learning

This repository consists of training material and examples related for AWS DevOps and python.
Apache License 2.0
0 stars 0 forks source link

Assignment 07 - S3 Basics #29

Open manishawsdevops opened 1 year ago

manishawsdevops commented 1 year ago

Title: Building a Static Website Hosting Solution with AWS S3, Versioning, and Lifecycle Policies

Assignment Description:

Objective: The objective of this assignment is to gain hands-on experience with Amazon Simple Storage Service (Amazon S3) by creating a static website hosting solution. You will learn how to host a static website, enable versioning for your objects, and implement lifecycle policies to manage object retention and storage costs effectively.

Assignment Tasks:

Task 1: Setting up an AWS Account

If you don't already have an AWS account, sign up for one by visiting https://aws.amazon.com/. You may use the AWS Free Tier to complete this assignment without incurring any charges.

Task 2: Create an S3 Bucket for Website Hosting

  1. Log in to the AWS Management Console.
  2. Navigate to the Amazon S3 service.
  3. Create a new S3 bucket with a unique name following S3 bucket naming rules.
  4. Configure the bucket settings for static website hosting, including index and error documents.
  5. Upload an HTML file and other necessary assets (CSS, JavaScript, images) to your S3 bucket to create a simple static website.

Task 3: Enable Versioning

  1. Enable versioning for your S3 bucket.
  2. Upload a new version of an existing HTML file to your bucket.
  3. Retrieve and display different versions of the HTML file using the AWS Management Console or AWS CLI.

Task 4: Implement Lifecycle Policies

  1. Create a lifecycle policy for the S3 bucket that transitions objects to the S3 Glacier storage class after 30 days.
  2. Create another lifecycle policy to delete objects in the Glacier storage class after 90 days.
  3. Observe how the lifecycle policies affect object storage and access.

Task 5: Testing the Static Website

  1. Access the static website hosted in your S3 bucket by navigating to the provided website endpoint URL.
  2. Verify that the website loads correctly, including all assets (images, stylesheets, JavaScript).
  3. Simulate a website update by uploading a new version of the HTML file and ensure that the changes are reflected on the website.

Task 6: Access Control and Permissions

  1. Implement an S3 bucket policy to restrict access to the website only from specific IP addresses.
  2. Create an IAM user with read-only permissions to access the S3 bucket.
  3. Test website access with both the restricted IP addresses and the IAM user's credentials.

Task 7: Logging and Monitoring

  1. Enable server access logging for the S3 bucket.

Task 8: Cleanup

  1. Delete all resources created during this assignment to avoid incurring AWS charges.

Submission: Prepare a report documenting your progress and findings for each task. Include screenshots, AWS CLI commands used, and any code snippets. Submit your report along with your AWS account username (email) used for this assignment.

Note: Ensure that you follow best practices for security, website optimization, and cost management when working with AWS resources. Always be mindful of your AWS account usage to avoid unexpected charges.