AWS Storage

  • If can install an OS on an storage then it is called as Block storage (EBS)
  • If can’t install os then called as Other storage (S3, EFS)

EC2 instance store

  • Temporary block-level storage for your instance
  • Ideal for temporary storage of information that changes frequently, such as
    • buffers, caches, scratch data, and other temporary content
  • Data in the instance store is lost under instance stops, hibernates, terminates, drive fails

EBS

  • Amazon Elastic Block Store (EBS)
  • It is an easy to use, high-performance, block-storage service designed for use with EC2
  • EC2 is a virtual server in a cloud while EBS is a virtual disk in a cloud
  • EBS volume does not exist on one disk, it spreads across the Availability Zone
  • By default we get EBS attach to EC2 instance
  • EBS volume types
    • SSD-backed volumes
    • HDD-backed volumes
    • Standard –> Currently not in use
  • Create EBS
    • EC2 > EBS > Volumes > Create volume

SSD-backed volumes

  • General Purpose SSD
    • Provides a balance of price and performance
    • We recommend these volumes for most workloads.
  • Provisioned IOPS SSD
    • Provides high performance for mission-critical, low-latency, or high-throughput workloads.
    • IOPS –> input/output operations per second

HDD-backed volumes

  • Throughput Optimized HDD
    • A low-cost HDD designed for frequently accessed, throughput-intensive workloads.
  • Cold HDD
    • The lowest-cost HDD design for less frequently accessed workloads.

Make an Amazon EBS volume available for use on Linux

  • When instance is deleted
    • Default root volume gets deleted
    • Attached EBS will remain
  • Attach additional EBS on Instance Launch
    • EC2 > Instances > Launch an instance > Configure storage > Add new volume
    • 2 volumes will be created in EBS > Volumes
      • One with snapshot_id –> root volume
      • Anther without snapshot_id –> Added EBS(Say 2GB)
  • Attach Old EBS to an instance
    • EC2 > EBS > Volumes > Select a volume > Attach volume
    • If Availability Zone of instance is us-east-1d then volume AZ should be exact same.
  • 1 EBS is connected to only 1 instatce
    • Detach vol from 1 instance and then Attach vol to other instance

Make availabe EBS vol for use

  • Use the lsblk command to view your available disk
lsblk

xvda     202:0    0    8G  0 disk 
├─xvda1  202:1    0  7.9G  0 part /
├─xvda14 202:14   0    4M  0 part 
└─xvda15 202:15   0  106M  0 part /boot/efi
xvdb     202:16   0    2G  0 disk 

# Here
* 8GB(xvda) is mounted on `/, /boot/efi`
* 2GB(xvdb) is not mounted
  • Check file formating
    • sudo file -s /dev/xvdb
    • if data –> no file system
  • Update filesystem to xfs –> This is format the storage
    • sudo mkfs -t xfs /dev/xvdb
    • XFS filesystem data
  • Create dir and mount the disk
    • mkdir mydisk
    • sudo mount /dev/xvdb /home/ubuntu/mydisk
  • Note:

Snapshots

  • Create a point-in-time snapshot of an EBS volume and use it as a baseline for new volumes or for data backup.
  • You can create snapshots from an individual volume, or you can create multi-volume snapshots from all of the volumes attached to an instance.
  • EC2 > EBS > Volumes > Select volume > create snapshot

Create AMI

  • Create an Snapshot of the instance root volume
  • And then Create image from the snapshot
    • EC2 > EBS > Snapshot > Select snapshot > Action > Create image

Data migration between AZs and Region

  • Move Volumes – diff AZ
    • Create Snapshot of the volume
    • Create another volume from the snapshot
      • Select proper AZ
  • Move AMI – Diff region
    • Create AMI from the snapshot created from instance root volume
    • Copy Amazon Machine Image (AMI)
      • EC2 > Images > AMIs > Select AMI > Action > Copy AMI
      • Select proper Region

RAID configuration on Linux

  • RAID 1 is also not recommended for use with Amazon EBS.
    • Because it requires more Amazon EC2 to Amazon EBS bandwidth than non-RAID configurations because the data is written to multiple volumes simultaneously.
  • RAID 5 and RAID 6 are not recommended for Amazon EBS
    • Because the parity write operations of these RAID modes consume some of the IOPS available to your volumes.

Amazon Elastic File System(EFS)

  • Simple, serverless, set-and-forget, elastic file system
  • Available only for Linux, has different service(FSx) for Windows
  • It automatically grows and shrinks as you add and remove files with no need for management or provisioning.
  • Amazon EC2, Amazon ECS, and AWS Lambda, can access the same EFS at the same time
  • Same EFS can be accessed by compute instances even if they are in different AZs, AWS Region or Account

Amazon FSx

  • Amazon FSx let you choose between four widely-used file systems:
    • NetApp ONTAP, OpenZFS, Windows File Server, and Lustre.

Storage Gateway(Hybrid cloud)

  • AWS Storage Gateway is a hybrid cloud storage service that gives you on-premises access to virtually unlimited cloud storage.
  • Storage Gateway enables you to reduce your on-premises storage footprint and associated costs by leveraging AWS storage services.
  • Storage Gateway is used when you use Hybrid cloud –> both on-premises and AWS cloud
  • Can be used when you want to upgrade to AWS cloud from on-premises without coplete upgrade at once.