AWS 183-[STOR]-Lab - Managing Storage

  Рет қаралды 62

Mark Mungai Kuria

Mark Mungai Kuria

Күн бұрын

#AWS 183-[STOR]-Lab - Managing Storage
Check out my GitHub Repository - github.com/MFM...
Portfolio
1. markfrancismk.s...
2. d2taxcp5hluc5o...
Here’s a comprehensive, step-by-step guide for completing the AWS lab assignment on managing storage. This guide includes detailed explanations for each step, relating to AWS services, and potential exam questions with detailed answers.
Lab Overview
In this lab, you will use AWS services to:
1. Create and manage Amazon EBS snapshots.
2. Sync files from an EBS volume to an Amazon S3 bucket.
3. Use Amazon S3 versioning to manage file versions.
Lab Environment
- VPC with public subnet.
- EC2 Instances:
- Command Host: Administer AWS resources.
- Processor: Manage EBS volumes and snapshots.
Duration
Approximately 45 minutes.
Task 1: Creating and Configuring Resources
Task 1.1: Create an S3 Bucket
1. Open AWS Management Console:
- Log in to AWS Management Console if you haven't already.
- Search for and select "S3" to open the S3 Management Console.
2. Create Bucket:
- Click on Create bucket.
- Bucket name: Enter a unique name (e.g., `my-snapshot-bucket-2024`). Bucket names must be globally unique.
- Region: Leave as default or select a region close to your EC2 instances.
- Click Create bucket.
Explanation:
- Bucket Name: Used to identify the bucket uniquely across all AWS accounts.
- Region: Ensures data is stored geographically close to your resources for low latency.
Task 1.2: Attach Instance Profile to Processor
1. Open EC2 Management Console:
- Search for and select "EC2".
2. Modify IAM Role:
- Go to Instances and select the "Processor" instance.
- Click Actions \ Security \ Modify IAM role.
- Choose the `S3BucketAccess` role from the IAM role dropdown list.
- Click Update IAM role.
Explanation:
- IAM Role: Grants the EC2 instance permissions to interact with other AWS services like S3.
- S3BucketAccess: Custom role with permissions to access S3 buckets.
Task 2: Taking Snapshots of Your Instance
Task 2.1: Connecting to the Command Host EC2 Instance
1. Connect Using EC2 Instance Connect:
- Open the EC2 Management Console.
- Go to Instances and select "Command Host".
- Click Connect and then Connect in the EC2 Instance Connect tab.
Explanation:
- EC2 Instance Connect: Provides secure and straightforward SSH access to your EC2 instances directly from the browser.
Task 2.2: Taking an Initial Snapshot
1. Find EBS Volume ID:
- Run the command:
```bash
aws ec2 describe-instances --filter 'Name=tag:Name,Values=Processor' --query 'Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.{VolumeId:VolumeId}'
```
- Note the `VolumeId` (e.g., `vol-1234abcd`).
2. Stop the Processor Instance:
- Find the instance ID:
```bash
aws ec2 describe-instances --filters 'Name=tag:Name,Values=Processor' --query 'Reservations[0].Instances[0].InstanceId'
```
- Stop the instance:
```bash
aws ec2 stop-instances --instance-ids INSTANCE-ID
```
- Verify the instance is stopped:
```bash
aws ec2 wait instance-stopped --instance-id INSTANCE-ID
```
3. Create a Snapshot:
- Run the command:
```bash
aws ec2 create-snapshot --volume-id VOLUME-ID
```
- Note the `SnapshotId` (e.g., `snap-0643809e73e6cce13`).
4. Check Snapshot Status:
- Run the command:
```bash
aws ec2 wait snapshot-completed --snapshot-id SNAPSHOT-ID
```
5. Restart the Processor Instance:
- Start the instance:
```bash
aws ec2 start-instances --instance-ids INSTANCE-ID
```
Explanation:
- EBS Volume ID: Identifies the volume from which snapshots are created.
- Snapshot: A backup of your EBS volume.
- Instance Stop/Start: Necessary because snapshots can only be taken when the instance is not using the volume.
Task 2.3: Scheduling Snapshot Creation
1. Create a Cron Job:
- Run the command to create a cron job that creates snapshots every minute:
```bash
echo " aws ec2 create-snapshot --volume-id VOLUME-ID 2\&1 \\ /tmp/cronlog" \ cronjob
crontab cronjob
```
2. Verify Snapshots:
- List snapshots:
```bash
aws ec2 describe-snapshots --filters "Name=volume-id,Values=VOLUME-ID"
```
Explanation:
- Cron Job: Automates snapshot creation every minute for testing purposes.
- /tmp/cronlog: Logs the output of the cron job.
Task 2.4: Retaining the Last Two Snapshots
1. Stop Cron Job:
- Run:
```bash
crontab -r
```
2. Run Python Script:
- View the Python script:
```bash
more /home/ec2-user/snapshotter_v2.py
```
- Run the script:
```bash
python3 snapshotter_v2.py
```
- Verify the remaining snapshots:
```bash
aws ec2 describe-snapshots --filters "Name=volume-id,Values=VOLUME-ID" --query 'Snapshots[].SnapshotId'
```
Explanation:
- Python Script: Keeps only the last two snapshots, deleting older ones.
Task 3: Challenge: Synchronize Files with Amazon S3
Task 3.1: Downloading and Unzipping Sample Files
1. Download Files:
- Run:
```bash

Пікірлер
AWS 184-[STOR]-Lab - [Challenge] S3 Exercise
13:08
Mark Mungai Kuria
Рет қаралды 59
Setting up a production ready VPS is a lot easier than I thought.
29:50
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
Running With Bigger And Bigger Lunchlys
00:18
MrBeast
Рет қаралды 109 МЛН
AWS 185-[STOR]-Lab - Work with Amazon S3
42:55
Mark Mungai Kuria
Рет қаралды 59
Introduction to AWS Services
38:54
AWS with Chetan
Рет қаралды 2,2 МЛН
AWS IAM Core Concepts You NEED to Know
21:40
Be A Better Dev
Рет қаралды 210 М.
File Storage VS Object Storage | System Design
5:20
System Design School
Рет қаралды 4,1 М.
AWS 188-[JAWS]-Lab - Managing Resources with Tagging
21:05
Mark Mungai Kuria
Рет қаралды 42
My DREAM Everyday Tech!
18:07
Mrwhosetheboss
Рет қаралды 4,5 МЛН
Why You NEED To Learn Terraform | Practical Tutorial
27:33
Travis Media
Рет қаралды 119 М.
AWS 179-[AWSD]-Lab - Migrate to Amazon RDS
40:52
Mark Mungai Kuria
Рет қаралды 144