JTCyberTech / Cybersecurity-Home-Labs

5 stars 1 forks source link

3. AWS S3 Basic Lab Task 5 and 6 #84

Open JTCyberTech opened 1 year ago

JTCyberTech commented 1 year ago

AWS S3 Basics Project

Task 5: Understand S3 Storage Classes and Create Lifecycle Rule for objects in AWS S3

Key Takeaways

S3 Storage Class



Creating Lifecycle Rule

- Navigate to the Versioning Bucket. Then click on "Management".



- Click on "Create lifecycle rule".



- Fill in the information: - Create a Lifecycle rule name: "First Lifecycle Rule". - Select "Apply to all object in the bucket". - Check the box for "I acknowledge". - For Lifecycle rule actions: - Check the box for: "Move current versions of objects between storage classes". - Check the box for: "Move noncurrent versions of objects between storage classes". - Check the box for: "Permanently delete noncurrent versions of objects".



- In the "Transition current versions of objects between storage classes" Section: - Choose storage class transitions: "Standard-IA"; Day after object creation: "30". - Click on "Add transition". - Choose storage class transitions: "Glacier Flexible Retrieval"; Day after object creation: "60". - Click on "I acknowledge".



- In the "Transition noncurrent versions of objects between storage classes" Section: - Choose storage class transitions: "Standard-IA"; Day after object creation: "30". - In the "Permanently delete noncurrent versions of objects" Section: - Days after objects become noncurrent: "60".



- At the bottom of the page, there is a summary of the rules. Click on "Create rule".



- Successfully created the Lifecycle rules.



Task 6: Create Static Website using AWS S3

Key Takeaways

- S3 is a very cost efficient way to host for sites that consist of files like html, CSS, JavaScript images, and fonts.

Create and Configure S3 Bucket For Website Hosting

- Navigate to the Buckets interface, click on "Create bucket".



- Fill in the information: - Give the bucket a unique name: "mywebsite177". - Uncheck the box for "Block all public access". - Check the box for "I acknowledge". - Keep everything else default. - Scroll down and click on "Create bucket".







Upload Content to the Bucket

- Click on the "New Bucket".



- Click on "Upload".



- Click on "Add files". Select both "error.html" and "index.html". Then, click on "Upload".



- Note: Successfully uploaded both "error.html" and "index.html" in the New bucket.

Enable Static Website Hosting Feature in the Bucket

- Click on "Properties".



- Scroll all the way to the bottom. - Click on "Edit" for Static website hosting.



- Click on "Enable" for Static website hosting. - Type in: "index.html" for Index document. - Type in: "error.html" for Error document. - Click on "Save changes" at the bottom of the page.



Make the Website Public with Bucket Policy

- Click on "Permissions".



- Click on "Edit" on Bucket Policy.



- Click on "Policy Generator".



- Put in the information: - Select Type of Policy "S3 Bucket Policy". - Effect: "Allow". - Principal "*". - AWS service: "Amazon S3". - Actions: select "GetObject". - ARN: - Copy the ARN from Edit bucket policy page. - Paste in the ARN section. - Click on "Add Statement". - Click on Generate Policy.



- Copy the policy. Then Paste it in the "Policy" section on the Edit bucket policy page.



- Make a small change on the policy. - On the "Resource" line. Add `/*` before ". - Click on "Save Change".



- Note: Successfully created the policy.

Access the Website

- Click on "Properties".



- Scroll down to the bottom. Click on the Website.



- Successful access the website.



- To get the "error page" on the website. - Edit the URL by adding: `/` and anything. Example: `/123adfs`