[AWS

EBS Volume

  • Allow your instance to persist data, even after their termination
  • Can only be mounted to one instance at a time
  • Bound to a specific availability zone (us-esat-1a volume cannot be attached to us-east-1b)
  • It's a network drive (not a physical drive)
    • Use for network communicate with instance
    • can be detached from an EC2 instance and attached to another one quickly
  • It's locked to an Availability Zone (AZ)
    • To move a volume across, you first need to snapshot it
  • Have to provisioned capcaity (size in GBs, and IOPS)

Delete on Termination attribute

  • By default, root Volume is deleted
  • Any other attached EBS Volume is not deleted

EBS Snapshots

  • For backup fo EBS at a point in time
  • Not necessary to detach volume to do snapshot, but recommeded
  • Can copy snapshots across AZ or Region by taking a snapshots and restore it in another AZ or Region

Copy Volume

  • From the snapshot, you are able to Copy the volume to another Region

Create a Volume

  • It contains the same content as the snapshot
  • You are able to change the size (because it is a new volume)
  • You are able to change AZ

AMI Overview

  • AMI = Amazon Machin Image
  • AMI are a customization of an EC2 instance
    • add your own sofrware, config, OS, monitoring...
    • Faster boot / configruiton time becasue all your software is pre-packaged
  • AMI are built for a sepcific region (can be copied across regions)
    • That's why in different region, EC2 AMI has different Id
  • You can launch EC2 instances from
    • a pulibc AMI: aws provided (linux 2)
    • Your own AMI: you make and maintain them yourself
    • An AWS marketplace AMI: An AMI someone else made and sells on market

Create AMI Process

  • Start an EC2 instance and customize it
  • Stop the instances (for data integrity)
  • Build an AMI - this will also create EBS snapshots
  • Launch instances from other AMIs

EC2 Instance Store

  • EBS Volumes are netowrk drive 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
  • Backups and Replication are your responsbility

EBS Volume Types

SSD for fast; HDD for throughput;

  • EBS Volmes are characterized in Sizse | Throughput | IOPS 
  • Only gp2/gp3 and io1/io2 can be used as boot volumes
  • Only SSD type of EBS volume can be boot volume

General Purpose SSD

  • Size: 1 GiB - 16 TiB

Provisioned IOPS SSD

  • Critical busniess application with sustained IOPS perforamnce
  • Or application that need more than 16,000 IOPS
  • Greate for database workloads (sensitive to storage perf and consisitency)

Hard Disk Drives (HDD)

  • Cannot be boot volume
  • 125 MiB to 16 TiB

EBS Multi-Attach - io 1 /io 2 family

  • Attach the same EBS volume to multiple EC2 instances in the same AZ
  • Each instance has full read & write permissions to the volume
  • Use Case: higher application availability in clustered Linux application, application must manage concurrent wrtie operations
  • Must use a file system that's cluster-aware (not, XFS, EX4...)

EFS - Elastic File System

  • Performance that scales to support any workload: EFS offers the throughput changing workloads need. It can provide higher throughput in spurts that match sudden file system growth, even for workloads up to 500,000 IOPS or 10 GB per second.
  • Managed NFS (network file system) that can be mounted on many EC2
  • EFS works with EC2 instances in multi-AZ
  • highly available, scalable expensive

  • Use cases: content management, web serving, data sharing, Wordpress
  • Uses NFSv4. I protocol
  • Use secirty group to control access to EFS (SG is a must)
  • Compatible with Linux based AMI (not windows)
  • Encryption at rest using KMS
  • Can scales automatically.

EFS - Performance & Storage Classes

EFS Scales

  • 1000s of concurrent NFS clients, 10 GB+ /s throughput
  • Grow to Petabyte-scale network file system, automatically

Performacne mode (set at EFS creation time)

  • General purpose(default): latency-sensitive use case (web server, CMS)
  • MAX I/O - higher latency, throughput, highly parallel (big data, media processing...)

Throughput mode

  • Bursting (1TB = 50MiB/s + burst of up to 100MiB/s)
  • Provisioned: set your throughput regardless of storage size

Storage Tiers (lifecycle management feature - move file after N days)

  • Standard: for frequently accessd files
  • Infrequent access(EFS-IA): cost to retrieve files, lower price to store


EBS is AZ locked, you cannot attach to an EC2 in a different AZ.

Multi-attach EBS can be attached to differnet AZ, but only for io1/io2 family

EFS is regional stroage, can be shared to multi AZ. EC2s can access EFS to get same content.

EFS is only Linux based

Instance store is for caching the data temp... will lose the data once instance is terminated. Performance for I/O is the best amount EFB, EBS

Is running a DB on EC2 instance store possible? It is possible to run a database on EC2. It is also possible to use instance store, but there are some considerations to have. The data will be lost if the instance is stopped, but it can be restarted without problems. One can also set up a replication mechanism on another EC2 instance with instance store to have a standby copy. One can also have back-up mechanisms. It's all up to how you want to set up your architecture to validate your requirements. In this case, it's around IOPS, and we build an architecture of replication and back up around i

Answer: Use EC2 intance store, for high-performance file storeage on disk. If you handle backup correct, instance store can be a good option.


The maximum ratio of provisioned IOPS to requested volume size (in GiB) is 50:1. So, for a 200 GiB volume size, max IOPS possible is 200*50 = 10000 IOPS. 15000 IOPS > 10000 IOPS, so it is wrong.

io2: ratio is 500:1

General Purpose SSD gp3 is also 500:1

General Purpose SSD (gp2) volumes offer cost-effective storage that is ideal for a broad range of workloads. These volumes deliver single-digit millisecond latencies and the ability to burst to 3,000 IOPS for extended periods of time. Between a minimum of 100 IOPS (at 33.33 GiB and below) and a maximum of 16,000 IOPS (at 5,334 GiB and above), baseline performance scales linearly at 3 IOPS per GiB of volume size.

 Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html

3 IOPS pre GiB

16000/3 = 5333.3GiB=5.3TiB

Encryption by default is a Region-specific setting. If you enable it for a Region, you cannot disable it fro individual volumes or snapshots in that region.

Set the DeleteOnTermination attribute to False using the command line - If the instance is already running, you can set DeleteOnTermination to False using the command line.

原文地址:https://www.cnblogs.com/Answer1215/p/14853318.html