INTRODUCTION TO CORE CONCEPTS
1.1 Amazon S3 (Simple Storage Service)
- What is S3?
Amazon S3 is an object storage service that offers scalability, durability, and security. It allows you to store and retrieve any amount of data at any time.
- Storage Classes:
- Standard: For frequently accessed data.
- Infrequent Access (S3-IA): For less frequently accessed data (lower cost than Standard).
- Glacier/Deep Archive: For archival data with retrieval times from minutes to hours.
- Lifecycle Management:
Automates transitioning objects between storage classes or deleting them after a defined period.
1.2 Amazon EBS (Elastic Block Store)
- What is EBS?
EBS provides block-level storage volumes for EC2 instances. Volumes persist independently of EC2 instance lifecycles.
- Volume Types: SSD (e.g., gp3, io2) for high IOPS, HDD (e.g., st1) for throughput-intensive workloads.
- Snapshots: Point-in-time backups of EBS volumes stored in S3.
2. Prerequisites
- An AWS account with IAM permissions for S3, EC2, and EBS.
- AWS CLI installed and configured (aws configure).
- Basic familiarity with Linux commands and SSH.
3. Hands-On Implementation
Task 1: Create an S3 Bucket, Upload Files, and Configure Lifecycle Management
- Step 1: Create an S3 Bucket
Via AWS Console:
- Go to S3 > Create bucket.
- Enter a unique bucket name (e.g., my-project-bucket-2023).
- Select a region (e.g., us-east-1).
Click Create bucket.
- Step 2: Upload Files
Via Console:
Navigate to your bucket > Upload > Select files > Upload.
- Step 3: Configure Lifecycle Policy
Objective:
- Transition objects to S3-IA after 30 days.
- Transition to Glacier after 90 days.
- Delete objects after 365 days.
Create Lifecycle Rule:
In your bucket, go to the Management tab → Lifecycle rules → Create lifecycle rule.
- Rule name: Auto-Transition-Delete.
- Rule scope: Apply to all objects.
- Transitions: Transition to Standard-IA: 30 days after creation. Transition to Glacier Flexible Retrieval: 90 days after creation.
Expiration:
Delete objects: 365 days after creation.Click Create rule.
Task 2. Create an EC2 Instance,EBS Volume, Attach to EC2, and Mount
Objective: Provision storage for an EC2 instance.
Step 1 Create an Instance
- Select an Instance Type
- Choose a hardware configuration:
- For testing, select t2.micro (free tier eligible).
- Click Next: Configure Instance Details.
Step 2: Create an EBS Volume
- Navigate to EC2 Console → Volumes → Create volume.
- Size: Specify size (e.g., 10 GiB).
- Availability Zone (AZ): Match the AZ of your EC2 instance (critical!).
- Click Create volume.
- Step 3: Attach the EBS Volume to an EC2 Instance
- Attach Volume:
- Right-click the new volume → Attach volume.
- Instance: Select your EC2 instance.
- Device name: Use /dev/sdf (Linux) or /dev/xvdf.
- Click Attach.
Step 3: Mount the EBS Volume on Linux
- SSH into the EC2 Instance:
ssh -i "my-key.pem" ubuntu@ec2-13-51-36-103.eu-north-1.compute.amazonaws.com
- Format and Mount:
- List disks: lsblk (identify the new volume, e.g., nvme1n1).
- Format the volume:
sudo mkfs -t ext4 /dev/nvme1n1
- Create a mount directory:
sudo mkdir /mnt/ebs-volume
- Mount the volume:
sudo mount /dev/nvme1n1 /mnt/ebs-volume
- Auto-mount on reboot:
echo "/dev/nvme1n1 /mnt/ebs-volume ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab
- Confirm if your Ebs-volume remain persistent after Reboot
Reboot Instance
Re-Connect to Instance
Confirm the Ebs-Volume remained mounted
Task 3. Create an EBS Snapshot
- Objective: Backup your EBS volume.
- Step 1: Create a Snapshot
Navigate to EC2 Console → Volumes → Select your EBS volume.
- Create Snapshot:
- Click Actions → Create snapshot.
- Description: Add a name (e.g., my-ebs-backup-2023).
- Click Create snapshot.
- Step 2: Verify Snapshot (Optional)
Go to Snapshots in the EC2 console. Your snapshot will appear once complete.
Conclusion
This project provided a hands-on exploration of two foundational AWS services: Amazon S3 for scalable object storage and Amazon EBS for persistent block storage. By completing the tasks, we’ve gained practical experience in automating data lifecycle management, provisioning storage resources, and ensuring data durability through backups. Below is a detailed breakdown of the key takeaways:
Key Achievements
- Automated Data Lifecycle Management with S3:
You configured lifecycle policies to transition objects between storage classes (Standard → S3-IA → Glacier) and delete them after a defined period. This demonstrates how businesses can optimize costs by aligning storage costs with data access patterns.
Real-World Use Case: Archiving logs, media, or compliance data that loses relevance over time but requires long-term retention.
- EBS Volume Setup and Integration with EC2:
By creating, attaching, and mounting an EBS volume, you learned how block storage complements EC2 instances. This is critical for applications requiring persistent data (e.g., databases, file servers).
Challenge Addressed: Ensuring data persists even if the EC2 instance is stopped or terminated.
- Data Protection with EBS Snapshots:
Snapshots provide point-in-time backups stored in S3, enabling disaster recovery. This is essential for compliance (e.g., GDPR, HIPAA) and minimizing downtime.
Top comments (0)