Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Vivesh
Vivesh

Posted on

     

AWS Data Storage Options: S3, EBS, and EFS

AWS provides diverse data storage options, each designed for specific use cases. Below is a comparison ofS3 (Simple Storage Service),EBS (Elastic Block Store), andEFS (Elastic File System):


1. Amazon S3 (Simple Storage Service)

Description:

  • Object storage service designed for scalability, durability, and availability.
  • Stores data as objects in buckets.
  • Accessible via HTTP(S) with a RESTful API.

Key Features:

  • Scalability: Handles petabytes of data seamlessly.
  • Durability: 99.999999999% (11 9's) durability.
  • Data Tiers: Standard, Infrequent Access (IA), Glacier for archiving.
  • Versioning & Lifecycle Management: For object versioning and transitions.
  • Global Access: Can be used with a CDN (CloudFront) for fast delivery.

Use Cases:

  • Static website hosting.
  • Backup and archival.
  • Data lakes for analytics.
  • Media storage and content distribution.

2. Amazon EBS (Elastic Block Store)

Description:

  • Block storage attached to EC2 instances, functioning as virtual hard drives.
  • Persistent storage that retains data even after EC2 instance termination.

Key Features:

  • Performance Modes: General Purpose SSD, Provisioned IOPS SSD, Throughput Optimized HDD, Cold HDD.
  • Snapshots: Backup volumes to S3 for recovery.
  • High Availability: Replicated within an Availability Zone (AZ).
  • Encryption: Supports data-at-rest encryption.

Use Cases:

  • Databases (e.g., MySQL, PostgreSQL).
  • Filesystem for EC2-based applications.
  • Transaction-heavy workloads requiring low latency.

3. Amazon EFS (Elastic File System)

Description:

  • Fully managed, scalable file storage accessible by multiple EC2 instances.
  • Compatible with NFSv4 and designed for concurrent access.

Key Features:

  • Elastic Scaling: Automatically scales as data grows.
  • Regional Access: Accessible across multiple Availability Zones.
  • Performance Modes: General Purpose and Max I/O for higher throughput.
  • Integration: Supports Amazon ECS and AWS Lambda for serverless workloads.

Use Cases:

  • Content management systems.
  • Shared development environments.
  • Big data and analytics requiring concurrent access.

Comparison Table

FeatureAmazon S3Amazon EBSAmazon EFS
Storage TypeObject storageBlock storageFile storage
AccessHTTP(S) APIAttached to EC2 instancesConcurrently by multiple EC2 instances
PerformanceVaries by tierHigh performance, low latencyHigh throughput
Durability11 9's durabilityAZ-level replicationAZ-level replication
ScalabilityVirtually unlimitedLimited to volume size (up to 16 TiB)Elastic scaling
CostPay for usageBased on provisioned capacityPay for usage
Best ForBackups, archives, and static contentDatabases and transactional workloadsShared file storage

Which One to Use?

Use CaseRecommended Option
Backup, static content hostingAmazon S3
Running a relational database on EC2Amazon EBS
Shared storage for multiple EC2 instancesAmazon EFS
Large-scale data analytics and machine learningAmazon S3
High-performance, low-latency applicationsAmazon EBS
Web applications needing shared filesAmazon EFS

Each storage option can complement the others. For example, you might store backups inS3, useEBS for database workloads, and leverageEFS for shared application files.


Task: Create an S3 Bucket and Upload/Download Files Using AWS CLI

Prerequisites

  1. AWS CLI Installed:
  2. AWS CLI Configured:

    • Run the following command and provide your AWS credentials:
     aws configure
  • You’ll need:
    • AWS Access Key
    • AWS Secret Access Key
    • Default Region (e.g.,us-east-1)
    • Default Output Format (e.g.,json)

Steps to Create an S3 Bucket

  1. Create the Bucket:
   aws s3 mb s3://your-bucket-name--region your-region
Enter fullscreen modeExit fullscreen mode

Replaceyour-bucket-name with a globally unique bucket name andyour-region with your desired AWS region (e.g.,us-east-1).

Example:

   aws s3 mb s3://my-awesome-bucket--region us-east-1
Enter fullscreen modeExit fullscreen mode
  1. Verify the Bucket Creation:
   aws s3ls
Enter fullscreen modeExit fullscreen mode

This lists all your buckets.


Steps to Upload a File

  1. Prepare a File:

    • Create a sample file to upload:
    echo"Hello, S3!"> hello.txt
  2. Upload the File:

   aws s3cphello.txt s3://your-bucket-name/
Enter fullscreen modeExit fullscreen mode

Example:

   aws s3cphello.txt s3://my-awesome-bucket/
Enter fullscreen modeExit fullscreen mode
  1. Verify the Upload:
   aws s3lss3://your-bucket-name/
Enter fullscreen modeExit fullscreen mode

Steps to Download a File

  1. Download the File:
   aws s3cps3://your-bucket-name/hello.txt ./downloaded-hello.txt
Enter fullscreen modeExit fullscreen mode
  1. Verify the File:
catdownloaded-hello.txt
Enter fullscreen modeExit fullscreen mode

This should displayHello, S3!.


Optional Commands

  1. List Files in the Bucket:
   aws s3lss3://your-bucket-name/
Enter fullscreen modeExit fullscreen mode
  1. Delete a File from the Bucket:
   aws s3rms3://your-bucket-name/hello.txt
Enter fullscreen modeExit fullscreen mode
  1. Delete the Bucket:

    • Ensure the bucket is empty first:
     aws s3 rb s3://your-bucket-name--force

Summary

  • Create a bucket:aws s3 mb
  • Upload files:aws s3 cp <file> s3://<bucket>
  • Download files:aws s3 cp s3://<bucket>/<file> <destination>

Happy Learning !!!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

####
  • Education
    ☘️
  • Work
    👨‍💻
  • Joined

More fromVivesh

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp