DEV Community

Sangwoo Lee
Sangwoo Lee

Posted on

[AWS] 4. EC2 Instance Storage Section, EBS (Elastic Block Store), AMI (Amazon Machine Image), EFS (Elastic File System)

EBS Volume

  • An EBS(Elastic Block Store) 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 can only be mounted to instance at a time (at the CCP level)
  • They are bound to a specific availability zone
  • Analogy: Think of them as a "network USB stick"
  • It's a network drive (i.e. not a physical drive)
    • It uses the network to communicate the instance, which means there might be a bit of latency
    • It can be detached from an EC2 instance and attached to another one quickly
  • It's locked to an Availability Zone (AZ)
    • An EBS Volume in us-east-1 a cannot be attached to us-east-1 b
    • To move a volume across, you first need to snapshot it
  • Have a provisioned capacity (size in GBs, and IOPS)
    • You get billed for all the provisioned capacity
    • You can increase the capacity of the drive over time
  • EBS Volume (EBS 볼륨)

  • 네트워크 드라이브로 실행 중인 인스턴스에 연결 가능

  • 인스턴스 종료 후에도 데이터 지속 가능

  • 한 번에 하나의 인스턴스에만 마운트 가능 (CCP 수준)

  • 특정 가용 영역에 종속

  • 비유: "네트워크 USB 스틱"

  • 네트워크 드라이브 특성

  • 물리적 드라이브가 아닌 네트워크 드라이브

    • 네트워크를 사용하여 인스턴스와 통신하므로 약간의 지연 발생 가능
    • EC2 인스턴스에서 분리했다가 다른 인스턴스에 빠르게 연결 가능
  • 가용 영역 제약

  • 특정 가용 영역(AZ)에 잠김

    • us-east-1a의 EBS 볼륨은 us-east-1b에 연결 불가
    • 다른 영역으로 이동하려면 먼저 스냅샷을 생성해야 함
  • 용량 프로비저닝

  • 프로비저닝된 용량 보유 (GB 단위 크기 및 IOPS)

    • 프로비저닝된 전체 용량에 대해 요금 청구
    • 시간이 지남에 따라 드라이브 용량 증가 가능

EBS Delete on Termination attribute

  • Control 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)
  • This can be controlled by AWS console / AWS CLI

  • Use case: preserve root volume when instance is terminated

  • EBS 볼륨 종료 시 동작

  • EC2 인스턴스 종료 시 EBS 동작 제어

    • 기본값: 루트 EBS 볼륨은 삭제됨 (속성 활성화)
    • 기본값: 연결된 다른 EBS 볼륨은 삭제되지 않음 (속성 비활성화)
  • AWS 콘솔 또는 AWS CLI로 제어 가능

  • 사용 사례: 인스턴스 종료 시 루트 볼륨 보존

EBS Snapshots

  • 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

  • EBS Snapshots (EBS 스냅샷)

  • 특정 시점의 EBS 볼륨 백업(스냅샷) 생성

  • 스냅샷 생성 시 볼륨 분리가 필수는 아니지만 권장됨

  • 스냅샷을 AZ 또는 리전 간 복사 가능

EBS Snapshots Features

  • EBS 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 EBS Snapshots
    • Setup rules to retain deleted snapshots so you can recover them after an accidental deletion
    • Specify retention (from 1day to 1year)
  • Fast Snapshot Restore (FSR)
    • Force full initialization of snapshot to have no latency on the first use ($$$)
  • EBS Snapshots 추가 기능

(1) EBS Snapshot Archive (스냅샷 아카이브)

  • 75% 저렴한 "아카이브 티어"로 스냅샷 이동
  • 아카이브 복원에 24~72시간 소요

(2) Recycle Bin for EBS Snapshots (스냅샷 휴지통)

  • 실수로 삭제된 스냅샷 복구를 위한 보존 규칙 설정
  • 보존 기간 지정 (1일~1년)

(3) Fast Snapshot Restore (FSR) (빠른 스냅샷 복원)

  • 스냅샷의 완전 초기화를 강제하여 첫 사용 시 지연 시간 제거 (비용 높음 $$$)

AMI Overview

  • AMI is 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-packaged
  • AMI are built for a specific region (and can be copied across regions)

  • You can launch EC2 instance 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)

AMI 개요

  • AMI는 EC2 인스턴스의 사용자 정의

    • 자체 소프트웨어, 구성, 운영 체제, 모니터링 등 추가
    • 모든 소프트웨어가 사전 패키징되어 있어 부팅/구성 시간 단축
  • AMI는 특정 리전용으로 빌드됨 (리전 간 복사 가능)

  • EC2 인스턴스 시작 가능 출처:

    • 퍼블릭 AMI: AWS 제공
    • 자체 AMI: 직접 생성 및 유지 관리
    • 마켓플레이스 AMI: 다른 사람이 만든 AMI (판매 가능)

AMI Process (from an EC2 instance)

  • Start an EC2 instance and customize it
  • Stop the instance (for data integrity)
  • Build an AMI - this will also create EBS snapshots
  • Launch instance from other AMIs
  • EC2 인스턴스에서 AMI 생성 프로세스
    • EC2 인스턴스를 시작하고 사용자 정의
    • 데이터 무결성을 위해 인스턴스 중지
    • AMI 빌드 - EBS 스냅샷도 함께 생성됨
    • 다른 AMI에서 인스턴스 시작

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 (ephemeral)
  • Good for buffer / cache / scratch data / temporary content
  • Risk of data loss if hardware fails
  • Backups and Replication are your responsibility

EC2 인스턴스 스토어

  • EBS 볼륨은 네트워크 드라이브로 성능이 좋지만 "제한적"
  • 고성능 하드웨어 디스크가 필요한 경우 EC2 Instance Store 사용
  • 더 나은 I/O 성능
  • EC2 Instance Store는 중지 시 스토리지 손실 (임시 저장소)
  • 버퍼/캐시/스크래치 데이터/임시 콘텐츠에 적합
  • 하드웨어 장애 시 데이터 손실 위험
  • 백업 및 복제는 사용자 책임

Local EC2 Instance Store

EBS Volume Types

  • EBS Volume come in 6types

    • gp2/gp3 (SSD): General purpose SSD volume that balances price and performance for a wide variety of workloads
    • io1/io2 Block Express (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 (I/O Ops Per Sec)

  • When in doubt always consult the AWS documentation

  • Only gp2/gp3 and io1/io2 Block Express can be used as boot volumes

  • EBS 볼륨 타입
    • EBS 볼륨은 6가지 타입으로 제공

(1) gp2/gp3 (SSD)

  • 다양한 워크로드에 대해 가격과 성능의 균형을 제공하는 범용 SSD 볼륨

(2) io1/io2 Block Express (SSD):

  • 미션 크리티컬 저지연 또는 고처리량 워크로드를 위한 최고 성능 SSD 볼륨

(3) st1 (HDD):

  • 자주 액세스되는 처리량 집약적 워크로드를 위해 설계된 저비용 HDD 볼륨

(4) sc1 (HDD):

  • 액세스 빈도가 낮은 워크로드를 위해 설계된 최저 비용 HDD 볼륨

  • 특징

  • EBS 볼륨은 크기, 처리량, IOPS(초당 I/O 작업)로 특성화됨

  • 확실하지 않을 때는 항상 AWS 문서 참조

  • 부팅 볼륨으로 사용 가능한 것은 gp2/gp3 및 io1/io2 Block Express만 가능

(1) EBS Volume Types Use cases - General Purpose SSD

  • Cost effective storage, low-latency
  • System boot volumes, Virtual desktops, Development and test environments
  • 1 GiB - 16 TiB
  • gp3:
    • Baseline of 3,000 IOPS and throughput of 125 MiB/s
    • Can increase IOPS up to 16,000 and throughput up to 1000MiB/s independently
  • gp2:
    • Small gp2 volume can burst IOPS to 3,000
    • Size of the volume and IOPS are linked, max IOPS is 16,000
    • 3 IOPS per GiB, means at 5,334 GiB we are at the max IOPS
  • 1. EBS 볼륨 타입 사용 케이스 - 범용 SSD

특징

  • 비용 효율적인 스토리지, 낮은 지연 시간
  • 사용 사례: 시스템 부팅 볼륨, 가상 데스크톱, 개발 및 테스트 환경
  • 크기: 1 GiB ~ 16 TiB

  • gp3

    • 기본 3,000 IOPS 및 125 MiB/s 처리량
    • IOPS를 최대 16,000까지, 처리량을 최대 1,000 MiB/s까지 독립적으로 증가 가능
  • gp2

    • 작은 gp2 볼륨은 3,000 IOPS까지 버스트 가능
    • 볼륨 크기와 IOPS가 연동됨, 최대 IOPS는 16,000
    • GiB당 3 IOPS, 즉 5,334 GiB에서 최대 IOPS 도달

(2) EBS Volume Types Use cases - Provisioned IOPS (PIOPS) SSD

  • Critical business applications with sustained IOPS performance
  • Or applications that need more than 16,000 IOPS
  • Great for databases workloads (sensitive to storage perf and consistency)
  • io1 (4GiB - 16TiB):
    • Max PIOPS: 64,000 for Nitro EC2 instances & 32,000 for other
    • Can increase PIOPS independently from storage size
  • io2 Block Express (4GiB - 64TiB):
    • Sub-millisecond latency
    • Max PIOPS: 456,000 with an IOPS:GiB ratio of 1,000:1
  • Supports EBS Multi-attach
    1. EBS 볼륨 타입 사용 케이스 - 프로비저닝된 IOPS SSD
  • 특징 및 사용 사례

    • 지속적인 IOPS 성능이 필요한 중요한 비즈니스 애플리케이션
    • 16,000 IOPS 이상이 필요한 애플리케이션
    • 데이터베이스 워크로드에 적합 (스토리지 성능 및 일관성에 민감)

  • io1 (4 GiB ~ 16 TiB)

    • 최대 PIOPS: Nitro EC2 인스턴스에서 64,000, 기타에서 32,000
    • 스토리지 크기와 독립적으로 IOPS 증가 가능
  • io2 Block Express (4 GiB ~ 64 TiB)

    • 밀리초 미만 지연 시간
    • 최대 PIOPS: 456,000 (IOPS:GiB 비율 1,000:1)
  • 추가 기능 : EBS Multi-attach

(3) EBS Volume Types Use cases - Hard Disk Drives (HDD)

  • Cannot be a boot volume
  • 125GiB to 16TiB
  • Throughput Optimized HDD (st1)
    • Big Data, Data Warehouses, Log Processing
    • Max throughput 500MiB/s - max IOPS 500
  • Cold HDD (cs1)
    • For data that is infrequently accessed
    • Scenarios where lowest cost is important
    • Max throughput 250MiB/s - max IOPS 250
    1. EBS 볼륨 타입 사용 케이스 - 하드디스크 드라이브
  • 공통특징 :

    • 부팅 볼륨으로 사용 불가
    • 크기: 125 GiB ~ 16 TiB
  • Throughput Optimized HDD (st1) (처리량 최적화 HDD)

    • 사용 사례: 빅데이터, 데이터 웨어하우스, 로그 처리
    • 최대 처리량: 500 MiB/s
    • 최대 IOPS: 500
  • Cold HDD (cs1) (콜드 HDD)

    • 자주 액세스하지 않는 데이터용
    • 최저 비용이 중요한 시나리오
    • 최대 처리량: 250 MiB/s
    • 최대 IOPS: 250

EBS Multi-Attach - io1/io2 family

  • Attach the same EBS volume to multiple EC2 instances in the same AZ
  • Each instances has full read & write permissions to the high-performance volume
  • Use case:
    • Achieve higher application availability in clustered Linux applications (ex: Teradata)
    • Applications must manage concurrent write operations
  • Up to 16 EC2 Instances at a time
  • Must use a file system that's cluster-aware (not XFS, EXT4, etc..)
  • EBS 다중 연결 - io1/io2 패밀리

    • 동일한 AZ 내의 여러 EC2 인스턴스에 동일한 EBS 볼륨 연결
    • 각 인스턴스는 고성능 볼륨에 대한 전체 읽기 및 쓰기 권한 보유
  • 사용 사례

    • 클러스터링된 Linux 애플리케이션에서 더 높은 애플리케이션 가용성 달성 (예: Teradata)
    • 애플리케이션이 동시 쓰기 작업을 관리해야 함
  • 제약 사항

    • 한 번에 최대 16개의 EC2 인스턴스
    • 클러스터 인식 파일 시스템 사용 필수 (XFS, EXT4 등은 불가)

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 volume are encrypted
  • EBS 암호화

    • 암호화된 EBS 볼륨 생성 시 제공되는 기능
    • 볼륨 내부의 저장 데이터 암호화
    • 인스턴스와 볼륨 간 이동하는 모든 전송 중 데이터 암호화
    • 모든 스냅샷 암호화
    • 스냅샷에서 생성된 모든 볼륨 암호화
  • 암호화 특징

    • 암호화 및 복호화는 투명하게 처리됨 (사용자가 할 일 없음)
    • 암호화가 지연 시간에 미치는 영향 최소화
    • EBS 암호화는 KMS의 키 활용 (AES-256)
    • 암호화되지 않은 스냅샷을 복사하면 암호화 가능
    • 암호화된 볼륨의 스냅샷도 암호화됨

Encryption: encrypt an unencrypted EBS volume

  • Create an EBS snapshot of the volume
  • Encrypt the EBS snapshot (using copy)
  • Create new EBS volume from the snapshot (the volume will also be encrypted)
  • Now you can attach the encrypted volume to the original instance
  • 암호화되지 않은 EBS 볼륨 암호화 방법

    • 1. 볼륨의 EBS 스냅샷 생성
    • 2. EBS 스냅샷 암호화 (복사 사용)
    • 3. 스냅샷에서 새 EBS 볼륨 생성 (볼륨도 암호화됨)
    • 4. 이제 암호화된 볼륨을 원본 인스턴스에 연결 가능

Amazon EFS - Elastic File System

  • Managed NFS (Network File System) that can be mounted on many EC2
  • EFS works with EC2 instances in multi-AZ
  • Highly available, scalable, expensive (3x gp2), pay per use

  • Use cases: content management, web serving, data sharing, Wordpress
  • Uses NFSv4.1 protocol
  • Uses security group to control access to EFS
  • Compatible with Linux based AMI (not Windows)
  • Encryption at rest using KMS
  • POSIX file system (~Linux) that has a standard file API
  • File system scales automatically, pay-per-use, no capacity planning!
  • Amazon EFS - Elastic File System (탄력적 파일 시스템)

    • 여러 EC2에 마운트할 수 있는 관리형 NFS(네트워크 파일 시스템)
    • EFS는 Multi-AZ의 EC2 인스턴스와 함께 작동
    • 고가용성, 확장 가능, 비용 높음 (gp2의 3배), 사용량 기반 요금
    • 사용 사례: 콘텐츠 관리, 웹 서빙, 데이터 공유, Wordpress
    • NFSv4.1 프로토콜 사용
    • 보안 그룹을 사용하여 EFS 액세스 제어
    • Linux 기반 AMI와 호환 (Windows 불가)
    • KMS를 사용한 저장 시 암호화
    • 표준 파일 API를 가진 POSIX 파일 시스템 (~Linux)
    • 파일 시스템이 자동으로 확장, 사용량 기반 요금, 용량 계획 불필요!

EFS - Performance & Storage Classes

  • EFS Scale

    • 1000s of concurrent NFS clients, 10GB+/s throughput
    • Grow to Petabyte-scale network file system, automatically
  • Performance Mode (set at EFS creation time)

    • 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 - 1TB = 50MiB/s + burst of up to 100MiB/s
    • Provisioned - set your throughput regardless of storage size, ex: 1GiB/s for 1TB storage
    • Elastic - automatically scales throughput up to down based on your workloads ⓐ. Up to 3GiB/s for reads and 1GiB/s for writes ⓑ. Used for unpredictable workloads
  • EFS 성능 및 스토리지 클래스

    • EFS Scale (EFS 확장성)
    • 1000개 이상의 동시 NFS 클라이언트, 10GB+/s 처리량
    • 페타바이트 규모의 네트워크 파일 시스템으로 자동 확장
  • 성능 모드 - EFS 생성 시 설정

    • General Purpose (default) (범용, 기본값)
    • 지연 시간에 민감한 사용 사례 (웹 서버, CMS 등)
    • 최대 I/O
    • 더 높은 지연 시간, 처리량, 고도로 병렬적 (빅데이터, 미디어 처리)
  • 처리량 모드

  • 버스팅

  • 1TB = 50MiB/s + 최대 100MiB/s까지 버스트

  • 프로비저닝

  • 스토리지 크기와 관계없이 처리량 설정, 예: 1TB 스토리지에 1GiB/s

  • 탄력적

  • 워크로드에 따라 처리량 자동 확장/축소

    • 읽기 최대 3GiB/s, 쓰기 최대 1GiB/s
    • 예측 불가능한 워크로드에 사용

EFS - Storage Classes

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

    • Standard: for frequently accessed files
    • Infrequent access (EFS-1A): cost to retrieve files, lower price to store
    • Archive: rarely accessed data (few times each year), 50% cheaper
    • Implement lifecycle policies to move files between storage tiers
  • Availability and durability

    • Standard: Multi-AZ, great for prod
    • One Zone: One AZ, great for dev, backup enabled by default, compatible with 1A (EFS One Zone-1A)
  • Over 90% in cost saving

  • EFS 스토리지 클래스

    • 스토리지 티어 - lifecycle management 기능: N일 후 파일 이동
    • 스탠다드 : 자주 액세스하는 파일용
  • 저빈도 액세스

  • 파일 검색 비용 발생, 저장 비용 낮음

  • 아카이브 : 거의 액세스하지 않는 데이터 (연간 몇 번), 50% 저렴

  • 수명 주기 정책 : 스토리지 티어 간 파일 이동 구현

  • 가용성 및 내구성

    • 스탠다드
    • Multi-AZ, 프로덕션에 적합
  • 단일 영역

    • One AZ, 개발에 적합
    • 기본적으로 백업 활성화
    • IA와 호환 (EFS One Zone-IA)
  • 비용 절감 : 90% 이상 비용 절감

EBS vs EFS - (EBS) Elastic Block Storage

  • EBS volumes
    • one instance (except multi-attach io1/io2)
    • are locked at the Availability Zone (AZ) level
    • gp2: IO increases if the disk size increases
    • gp3 & io1: 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 get terminated. (you can disable that)
  • (EBS) Elastic Block Storage

  • EBS volumes (EBS 볼륨)

    • 한 번에 하나의 인스턴스에만 연결 (multi-attach io1/io2 제외)
    • 가용 영역(AZ) 수준에 잠김
    • gp2: 디스크 크기가 증가하면 IO도 증가
    • gp3 & io1: IO를 독립적으로 증가 가능
  • AZ 간 EBS 볼륨 마이그레이션

    • 스냅샷 생성
    • 다른 AZ에 스냅샷 복원
    • EBS 백업은 IO를 사용하므로 애플리케이션이 많은 트래픽을 처리하는 동안 실행하지 않는 것이 좋음
  • Root EBS 볼륨

    • EC2 인스턴스가 종료되면 기본적으로 루트 EBS 볼륨도 종료됨 (비활성화 가능)

EBS vs EFS - (EFS) Elastic File System

  • Mounting 100s of instances across AZ
  • EFS share website files (WordPress)
  • Only for Linux Instances (POSIX)
  • EFS has a higher price point than EBS
  • Can leverage Storage Tiers for cost savings
  • Remember: EFS vs EBS vs Instance Store
  • (EFS) Elastic File System

    • 여러 AZ에 걸쳐 수백 개의 인스턴스 마운트 가능
    • EFS로 웹사이트 파일 공유 (WordPress)
    • Linux 인스턴스만 지원 (POSIX)
    • EFS는 EBS보다 가격이 높음
    • 비용 절감을 위해 Storage Tiers 활용 가능
    • 기억할 것: EFS vs EBS vs Instance Store

Top comments (0)