Featured image of post AWS 3: Block Volume and Snapshot

AWS 3: Block Volume and Snapshot

learning AWS Elastic Block Store (EBS), snapshot, Intance Store, EFS, AMI

EBS (Elastic Block Store)

  • An EBS Volume is a network drive you can attach to your instances while they run.
  • It allows your instances to persist data, even after their termination
  • They are bound to a specific availability zone

Snapshot

  • make a backup (snapshot) of your EBS volume at a point in time
  • not necessary to detach volume to do snapshot, but recommended
  • can copy snapshots across AZ or region
  • Snapshot Archive
    • move a snapshot to an ‘archive tier’ that is 75% cheaper
    • takes within 24 to 72 hours for restoring the archive
  • Recycle Bin for Snapshots
    • Setup rules to retain deleted snapshots so you can recover them after an accidental deletion
    • Specify retention (from 1 day to 1 year)

EC2 Instance Store

  • EBS volumes are network drives with good but “limited” performance
  • if you need a high-performance hardware disk, use EC2 Instance Store
  • Better I/O performance
  • EC2 Instance Store lose their storage if they’re stopped
  • good for buffer / cache / scratch data / temporary content
  • risk of data loss if hardware fails
  • backup and replication are your responsibility

EFS (Elastic File System)

  • EFS works with Linux EC2 instances in multi-AZ
  • managed NFS (network file system) that can be mounted on 100s of EC2
  • Highly available, scalable, expensive (3x gp2), pay per use, no capacity planning

EFS Infrequent Access (EFS-IA)

  • storage class that is cost-optimized for files not accessed every day
  • up to 92% lower cost compared to EFS standard
  • EFS will automatically move your files to EFS-IA based on the last time they were accessed
  • Enable EFS-IA with a Lifecycle Policy
  • Example: move files that are not accessed for 60 days to EFS-IA

AMI

Overview

  • AMI = Amazon Machine Image
  • AMI are a customization of an EC2 instance
    • you add your own software, configuration, operating system, monitoring
    • faster boot / configuration time because all your software is pre-package
  • AMI are built for a specific region (and can be copied across regions)
  • You can launch EC2 instances from:
    • A Public AMI: AWS provided
    • your own AMI: you make and maintain them yourself
    • An AWS Marketplace AMI: an AMI someone else made (and potentially sells)

Process

  • start an EC2 instance and customize it
  • stop the instance (for data integrity)
  • build an AMI – this will also create EBS snapshots
  • launch instances from other AMIs

aws-ami-process

Hands on

Create EBS Volume

  1. create new instance (see tutorial in the aws-ec2)
  2. check the EBS by clicking the new instance > “Storage” tab > “Block devices”
  3. to add new volume to the instance, create new one and config the “Volume settings” as figure below aws-ebs-volume-settings
  4. to see the AZ of the instance, click the instance > “Networking” tab > see “Availability zone”
  5. you can also config the volume during the creation of new instance like the figure below aws-ebs-init-volume-instance

Snapshot

Volume to Snapshot

  1. pick a volume you want to create snapshot, click “Actions” and choose “Create snapshot” aws-ebs-create-snapshot
  2. then you can give description in the snapshot details and add some tags. after finish, click “Create snapshot”

Copy snapshot

  1. in the “Snapshots” menu, right click a snapshot and click “Copy snapshot” aws-ebs-copy-snapshot
  2. in the “Snapshot copy details”, you can pick “Destination Region” is the region in which to create the snapshot copy.
  3. then click “Copy snapshot” button on the right bottom conner.
  4. since I copied the snapshot to ap-south-2, so the snapshot can be seen in that region

Snapshot to Volume

  1. to make volume from the copied snapshot, click right on the snapshot and choose “Create volume from the snapshot” aws-ebs-snapshot-to-vol
  2. then under the “Volume settings” you can configure some parameter and set the Availability Zone within the region (e.g. ap-south-2a, b, and c)

Recycle Bin

  1. from the “Snapshots” menu, click “Recycle Bin” on top bar (between refresh and Actions button)
  2. On the Recycle Bin page, click “Create retention rule” button
  3. Then below the “Create retention rule” form, set some parameters, then click “Create retention rule” button on the bottom right conner.
  4. Then check on the “Retention rules”, you should have one now.
  5. And then check on the “Resources”, you have no resources aws-ebs-recyclebin
  6. Then delete the snapshot
  7. refresh again the “Resources” page, now you must see the deleted snapshot there
  8. you can play around with “recover” button to bring snapshot back
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus