본문 바로가기
AWS Solutions Architect Associate 자격증

Section 7 : Instance Storage

by Jackykim 2023. 8. 29.

EBS : An EBS (Elastic Block Store) Volume is a network drive you can attach to your instances while they run and allows data to persist even after their termination.
- They can only be mounted to instance at a time and bound to a specific AZ (Free tier is 30gb)
- It can be detached from an EC2 and attached to another one quickly
- To move AZ you first need to snapshot it
- Get billed for all the provisioned capacity

EBS – Delete on Termination attribute
Controls the EBS behaviour when an EC2 instance terminates
By default, the root EBS volume is deleted (attribute enabled)
By default, any other attached EBS volume is not deleted (attribute disabled)
- Preserve root volume when instance is terminated

 

EBS Hands on
- Select the instance and then go to storage, you can check the attached ebs information
- Can check and select Volume settings -> you can check the AZ in networking in instance
- After creating -> you have to attach the volume to the instance manually -> go to EC2 storage to check if the volumes are attached

EBS Snapshots
- A Backup of your EBS volume and can copy snapshots across AZ

EBS snapshot archive
- Move a snapshot to an archive tier that is 75% cheaper and takes within 24~72 hours for restoring the archive

Recycle bin for EBS snapshots
- Setup rules to retain deleted snapshots so you can recover them after an accidental deletion

Fast snapshot Restore
- Force full initialization of snapshot to have no latency on the first use

 

EBS snapshot – Hands on
- EC2 -> volumes -> create snapshot -> copy snapshot to another AZ (to backup data)
- Create volume with snapshot -> re create ebs volume across AZ
- Recycle Bin -> retention rules -> move storage to archive -> recover snapshots after deleting

 

AMI Overview
- AMI are a customization of an EC2 instance (you can create your own software, config, etc)
- AMI are built for a specific region and you can launch EC2 instances from a public AMI, your own AMI or an AWS marketplace AMI
AMI process : Start an EC2 and customize it / build an AMI which will create EBS snapshot and launch instances from other AMI’s

 

AMI – Hands on
- Launch instance -> advanced details and copy user data (except the last line) -> launch the instance -> take some time for it to work -> right click and click create image -> configure the settings and click create
- You can check by going to images (AMI) and then you can launch instances straight from there or create EC2 from my own AMI (booting from a custom AMI can be faster)

 

EC2 Instance store
- EBS volumes are network drives with good but limited performance
- High performance hardware disk, use EC2 instance store for better I/O performance
- EC2 instance store lose their storage if they’re stopped
- Good for buffer / cache / scratch data / temp content
- but risk of data loss if hardware loss so backup and replication is necessary and responsibility

 

EBS Volume types (6 types)
- gp2 / gp3 (SSD): General purpose SSD volume that balances price and performance for

a wide variety of workloads

- io1 / io2 (SSD): Highest-performance SSD volume for mission-critical low-latency or

high-throughput workloads

- st1 (HDD): Low cost HDD volume designed for frequently accessed, throughput- intensive workloads

- sc1 (HDD): Lowest cost HDD volume designed for less frequently accessed workloads
- EBS volumes are characterized in size / throughput / IOPS and only gp2/gp3 and io1/io2 can be used as boot volumes

 

General purpose SSD
- Cost effective storage, low latency
- System boot volumes, Virtual desktops, Development and test environments
gp3:

Baseline of 3,000 IOPS and throughput of 125 MiB/s

Can increase IOPS up to 16,000 and throughput up to 1000 MiB/s independently

gp2:

Small gp2 volumes can burst IOPS to 3,000

Size of the volume and IOPS are linked, max IOPS is 16,000

3 IOPS per GB, means at 5,334 GB we are at the max IOPS

Provisioned IOPS (PIOPS) SSD
- Critical business applications with sustained IOPS performance
- Applications that need more than 16,000 IOPS
- Great for databases workloads
- io1/io2 (4 GiB - 16 TiB):

Max PIOPS: 64,000 for Nitro EC2 instances & 32,000 for other

Can increase PIOPS independently from storage size

io2 have more durability and more IOPS per GiB (at the same price as io1)

- io2 Block Express (4 GiB – 64 TiB):

Sub-millisecond latency

Max PIOPS: 256,000 with an IOPS:GiB ratio of 1,000:1

- Supports EBS Multi-attach

Hard disk drives (HDD)
- cannot be a boot volume
- 125 GIB to 16 TIB and throughout optimized HHD
- Cold HDD for data that is infrequently accessed and scenarios where lowest cost is important with a max throughput 250 Mib/s – max IOPS 250

EBS multi-Attach – io1 / io2 family
- Attach the same ebs volume to multiple EC2 instances in the same AZ and each instances has full & write permissions
- Used when needed to achieve higher application availability in clustered Linux applications and must manage concurrent write operations
- Up to 16 EC2 instances at a time 
-
Must use a file system that’s cluster-aware

 

EBS Encryption
- When you create an encrypted EBS volume, you get the following:

Data at rest is encrypted inside the volume

All the data in flight moving between the instance and the volume is encrypted

All snapshots are encrypted

All volumes created from the snapshot

- Encryption and decryption are handled transparently (you have nothing to do)

- Encryption has a minimal impact on latency

- EBS Encryption leverages keys from KMS (AES-256)

- Copying an unencrypted snapshot allows encryption

- Snapshots of encrypted volumes are encrypted


To encrypt an EBS volume
- Create an EBS snapshot of volume -> Encrypt the EBS snapshot
- Create new EBS volume from the snapshot and now you can attach the encrypted volume to the original instance

Amazon EFS – Elastic File System
- Managed NFS that can be mounted on many EC2 and works with EC2 instances in multi AZ
- Highly available, scalable, however very expensive, pay per use

 

- Used for content management, web serving, data waring, wordpress
- Uses NFSv4.1 protocol and uses security group to control access and compatible with linux based AMI
- Encryption available and no capacity planning

EFS – Performance & storage classes
- EFS scale
1000s of concurrent NFS clients, 10 GB+ /s throughput

Grow to Petabyte-scale network file system, automatically
- Performance Mode
General Purpose (default) – latency-sensitive use cases (web server, CMS, etc…)

Max I/O – higher latency, throughput, highly parallel (big data, media processing)
- Throughput mode
Bursting – 1 TB = 50MiB/s + burst of up to 100MiB/s

Provisioned – set your throughput regardless of storage size, ex: 1 GiB/s for 1 TB storage

Elastic – automatically scales throughput up or down based on your workloads

Up to 3GiB/s for reads and 1GiB/s for writes

Used for unpredictable workloads

EFS – Storage classes
- Storage Tiers (lifecycle management feature move file after N days)
• Standard: for frequently accessed files
• Infrequent access (EFS-IA): cost to retrieve files, lower price to store. Enable EFS-IA with a Lifecycle Policy

- Availability and durability
• Standard: Multi-AZ, great for prod
• One Zone: One AZ, great for dev, backup enabled by default, compatible with IA (EFS One Zone-IA)

 

Amazon EFS – Hands on
- Go to EFS system and create EFS -> click customize -> select your system
- Choose between general purpose or Max I/O
- Must choose a VPC and choose the AZ + security group then create
- Go to create new instance -> edit network and select subnet -> select EFS and choose a EFS
- After selecting everything launch the instance
- You can check all the security rules at the EFS
- Once you connect to your instance, you can create files and check that they are getting saved

EBS vs EFS – Elastic Block Storage
EBS :
- one instance and locked at AZ level
- gp2: IO increases if the disk size increases
- IO 1: can increase IO independently
To migrate an EBS volume across AZ

Take a snapshot

Restore the snapshot to another AZ

EBS backups use IO and you shouldn’t run them while your application is handling a lot

of traffic

- Root EBS Volumes of instances get terminated by default if the EC2 instance gets terminated.

EFS :
- Mounting 100s of instances across AZ
- EFS share website files
- Only for Linux and more expensive
- Can leverage EFS-IA for cost savings