AWS EC2(3) - 비용
1. What’s an EBS Volume
An EBS (Elastic Block Store) Volume is a network drive you can attach to your instances while they run
⇒ EBS 볼륨이란 현재 동작중인 인스턴스에 attach 가능한 네트워크 드라이브를 지칭한다
It allows your instances to persist data, even after their termination
⇒ EBS 볼륨은 인스턴스가 terminate 된다해도 데이터가 유지되도록 한다
They can only be mounted to one instance at a time (at the CCP level)
⇒ 한번에 1개의 인스턴스에 mount 가능하다
They are bound to a specific availability zone
⇒ 특정 Availabilty Zone에 바운드된다
Analogy : Think of them as a “network USB stick”
⇒ Analogy : 네트워크 USB 드라이브로써 생각
Free tier: 30 GB of free EBS storage of type General Purpose (SSD) or Magnetic per month
⇒ 프리티어 : General Purpose 목적으로는 30GB EBS는 무료이고, Magnetic으로는 달마다 요금발생
2. EBS Volume
- 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
⇒ EBS 볼륨은 인스턴스와 통신하기위해 사용되어지는데, 이는 소량의 지연율이 존재한다는 의미
It can be detached from an EC2 instance and attached to another one quickly
⇒ 한 EC2 인스턴스에서 분리해서 다른 인스턴스에 갖다 붙일수도 있다
- It’s locked to an Availability Zone (AZ) ⇒ 한 AZ에 귀속되어져 있다
An EBS Volume in us-east-1a cannot be attached to us-east-1b
⇒ 즉, us-east-1a에 있던 EBS 볼륨이 us-east-1b에 붙여질수는 없다
To move a volume across, you first need to snapshot it
⇒ 볼륨을 다른 AZ를 건너 사용하려면, snapshot부터 찍어야한다
- Have a provisioned capacity (size in GBs, and IOPS) ⇒ 예약된 용량을 가진다
You get billed for all the provisioned capacity
⇒ 사용자는 모든 provision된 용량에 대해 비용이 청구된다
You can increase the capacity of the drive over time
⇒ 시간한정을 넘어선 드라이브용량 증가가 가능
3. EBS Delete on Termination attribute
Controls the EBS behaviour when an EC2 instance terminates
⇒ EC2 인스턴스 terminate시의 EBS 조치
By default, the root EBS volume is deleted (attribute enabled)
⇒ default로, root EBS 볼륨인 삭제된다
By default, any other attached EBS volume is not deleted (attribute disabled)
⇒ default로, 다른 attach된 EBS 볼륨은 삭제되지 않는다
This can be controlled by the AWS console / AWS CLI
⇒ AWS console / AWS CLI을 이용하여 관리될수있다
Use case: preserve root volume when instance is terminated
⇒ 사용 예 : 인스턴스 삭제 시, root 볼륨 보존
4. EBS Snapshots
Make a backup (snapshot) of your EBS volume at a point in time
⇒ 시간내에 EBS 볼륨 내 한 지점에대한 백업본을 생성한다
Not necessary to detach volume to do snapshot, but recommended
⇒ 꼭 볼륨을 detach할 필요는 없지만, 왠만하면 detach하는걸 추천
Can copy snapshots across AZ or Region
⇒ AZ나 region을 넘어서도 copy 가능
5. EBS Snapshots Features
- EBS Snapshot Archive (EBS snapshot 아카이브)
Move a Snapshot to an ”archive tier” that is 75% cheaper
⇒ snapshot을 “아카이브 티어”란 곳에 옮기는데, 75% 더 싸다
Takes within 24 to 72 hours for restoring the archive
⇒ 아카이브 복구에 있어서 24시간에서 72시간이 소요된다
- Recycle Bin for EBS Snapshots (EBS snapshot 전용 휴지통)
Setup rules to retain deleted snapshots so you can recover them after an accidental deletion
⇒ 지워진 snapshot에 대한 rule 생성이 가능하다. 따라서, 사용자는 예기지못한 삭제에 대해 복구가 가능하다
Specify retention (from 1 day to 1 year)
⇒ 보존기간 지정 가능 (1일부터 1년까지)
- Fast Snapshot Restore (FSR) (빠른 snapshot 복구)
Force full initialization of snapshot to have no latency on the first use ($$$)
⇒ snapshot 강제 초기화에 대해서는 첫 사용에 있어서 지연율이 없음
6. AMI Overview
- AMI = Amazon Machine Image (아마존 머신 이미지)
AMI are a customization of an EC2 instance
⇒ EC2 인스턴스 커스터마이제이션 툴이다
You add your own software, configuration, operating system, monitoring…
⇒ 사용자 본인만의 소프트웨어, 설정, OS, 모니터링 가능
Faster boot / configuration time because all your software is pre-packaged
⇒ 부팅 및 설정에 있어 빠른 시간내에 소요, 그 이유는 모든 소프트웨어가 이미 pre 패키징 되어 있음
AMI are built for a specific region (and can be copied across regions)
⇒ AMI는 특정 region에 빌드되어지고, 다른 region을 넘어 copy도 가능하다
You can launch EC2 instances from:
1) A Public AMI: AWS provided
⇒ 공용 AMI : AWS에서 제공
2) Your own AMI: you make and maintain them yourself
⇒ 사용자 소유 AMI : 생성과 유지를 사용자가 직접 진행
3) An AWS Marketplace AMI: an AMI someone else made
⇒ AWS 마켓플레이스 AMI : 다른 사용자가 만든 AMI
7. AMI Process (from an EC2 instance)
1) Start an EC2 instance and customize it
⇒ EC2 인스턴스 시작 및 커스터마이징
2) Stop the instance (for data integrity)
⇒ 인스턴스 중지 (데이터 저장 및 통합을 위해서임)
3) Build an AMI – this will also create EBS snapshots
⇒ AMI 빌드 : 이 과정에서 EBS snapshot까지 생성된다
4) Launch instances from other AMIs
⇒ 다른 AMI를 이용하여 인스턴스 시작
8. EC2 Instance Store
EBS volumes are network drives with good but “limited” performance
⇒ EBS 볼륨은 좋으면서도 “한정된” 성능을 가진 네트워크 드라이브이다
If you need a high-performance hardware disk, use EC2 Instance Store
⇒ 만약 고성능 하드웨어 디스크가 필요할 시, EC2 인스턴스 스토어를 사용한다
Better I/O performance
⇒ I/O 성능이 높아진다
EC2 Instance Store lose their storage if they’re stopped (ephemeral)
⇒ EC2 인스턴스 스토어는 stop될시 storage를 모두 잃게 된다
Good for buffer / cache / scratch data / temporary content
⇒ 버퍼, 캐시, data 스크래치, 임시 콘텐츠에 좋다
Risk of data loss if hardware fails
⇒ 하드웨어가 뻑갈시 데이터 손실 위험성 존재
Backups and Replication are your responsibility
⇒ 백업본과 복제본은 모두 온전히 사용자 책임
9. EBS Volume Types
- EBS Volumes come in 6 types ⇒ EBS 볼륨에는 6가지 타입이 존재한다
gp2 / gp3 (SSD): General purpose SSD volume that balances price and performance for a wide variety of workloads
⇒ General purpose SSD 볼륨은 다양한 워크로드에 대해서 가격과 성능 밸런싱을 가진다
io1 / io2 (SSD): Highest-performance SSD volume for mission-critical low-latency or high-throughput workloads
⇒ 고성능 SSD 볼륨은 성능 우선과 저지연율 그리고 고성능의 워크로드를 지닌다
st1 (HDD): Low cost HDD volume designed for frequently accessed, throughput intensive workloads
⇒ 저비용 HDD 볼륨은 빈번한 접근성 및 처리량에 강한 워크로드를 가진다
sc1 (HDD): Lowest cost HDD volume designed for less frequently accessed workloads
⇒ 저비용 HDD 볼륨은 빈번한 접근성 및 처리량에 강한 워크로드를 가진다
EBS Volumes are characterized in Size Throughput IOPS (I/O Ops Per Sec) ⇒ EBS 볼륨은 사이즈, 처리량 IOPS에 특화되어 있다
When in doubt always consult the AWS documentation
⇒ AWS 문서에 항상 내용들이 적혀 있음
Only gp2/gp3 and io1/io2 can be used as boot volumes
⇒ 오직 gp2/gp3와 io1/io2가 boot 볼륨으로써 사용된다
1) General Purpose SSD
Cost effective storage, low-latency
⇒ 비용 효율적인 스토리지이며 낮은 지연율을 가진다
System boot volumes, Virtual desktops, Development and test environments
⇒ 시스템 boot 볼륨, 가상 데스크톱, 개발과 테스트 환경
- 1 GiB - 16 TiB (1기가에서 16테라 까지 사용가능)
- gp3
Baseline of 3,000 IOPS and throughput of 125 MiB/s
⇒ 3000개의 IOP와 125 MB/s의 처리량 확인
Can increase IOPS up to 16,000 and throughput up to 1000 MiB/s independently
⇒ IOP 갯수를 16,000개 까지 증가시킬 수 있고, 1000 MB/s 까지의 처리량 확인 가능
- gp2
Small gp2 volumes can burst IOPS to 3,000
⇒ 작은 gp2 볼륨을 IOP 3000개 까지 증설가능
Size of the volume and IOPS are linked, max IOPS is 16,000
⇒ 볼륨과 IOP의 사이즈를 연결시키면, 최대 IOP 16,000개 까지도 가능
3 IOPS per GB, means at 5,334 GB we are at the max IOPS
⇒ 1GB당 3개의 IOP이며, 이는 곧 5,334GB일시 최대 IOP 갯수에 다다랐다는 뜻이다
2) Provisioned IOPS (PIOPS) SSD
Critical business applications with sustained IOPS performance
⇒ 지속되는 IOP 성능을 지니는 크리티컬한 비즈니스 어플리케이션에 사용
Or applications that need more than 16,000 IOPS
⇒ 16,000개의 IOP이상이 필요한 어플리케이션
Great for databases workloads (sensitive to storage perf and consistency)
⇒ 데이터베이스 워크로드에 가장 좋음
- 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
⇒ EBS 다중 attach 지원
3) Hard Disk Drives (HDD)
Cannot be a boot volume
⇒ 볼륨 부팅 불가
125 GiB to 16 TiB
⇒ 125GB에서 16테라까지 가능
- Throughput Optimized HDD (st1) ⇒ 최적화된 HDD 처리량
- Big Data, Data Warehouses, Log Processing ⇒ 빅데이터, 데이터웨어하우스
- Max throughput 500 MiB/s – max IOPS 500 ⇒ 최대 처리량 500MiB
- Cold HDD (sc1):
- For data that is infrequently accessed ⇒ 빈번하지않은 접근
- Scenarios where lowest cost is important ⇒ 저비용 시나리오가 가장 중요
- Max throughput 250 MiB/s – max IOPS 250 ⇒ 최대 250MiB/s의 처리량 - 최대 250개 IOP
10. EBS Multi-Attach – io1/io2 family
Attach the same EBS volume to multiple EC2 instances in the same AZ
⇒ 동일한 EBS 볼륨을 같은 AZ내의 다수의 EC2 인스턴스에 attach 가능
Each instance has full read & write permissions to the high-performance volume
⇒ 각 인스턴스는 고성능 볼륨을 위한 full Read/Write 권한을 가진다
- 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 (중요)
⇒ 최대 16개의 EC2 인스턴스까지 가능
- Must use a file system that’s cluster-aware (not XFS, EXT4, etc…) io2 volume with Multi-Attach
11. 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
⇒ 암호화는 지연율에 있어 최소의 impact를 지님
EBS Encryption leverages keys from KMS (AES-256)
⇒ EBS 암호화 leverage key는 KMS로 부터 온다
Copying an unencrypted snapshot allows encryption
⇒ 복호화된 한 스냅샷을 카피하는 행위는 암호화를 가능케 한다
Snapshots of encrypted volumes are encrypted
⇒ 암호화된 볼륨의 스냅샷은 암호화된다
12. Encryption : encrypt an unencrypted EBS volume
Create an EBS snapshot of the volume
⇒ EBS 볼륨의 스냅샷을 만들어낸다
Encrypt the EBS snapshot ( using copy )
⇒ EBS 스냅샷을 암호화한다 (copy사용)
Create new ebs volume from the snapshot ( the volume will also be encrypted )
⇒ 스냅샷으로 부터 새로운 EBS 볼륨을 만들어낸다
Now you can attach the encrypted volume to the original instance
⇒ 이제 암호화된 볼륨을 원본 인스턴스에 attach 가능하다
13. Amazon EFS - Elastic File System
Managed NFS (network file system) that can be mounted on many EC2
⇒ NFS를 통해서 다수의 EC2에 마운팅이 가능하다
EFS works with EC2 instances in multi-AZ
⇒ EFS는 다수의 AZ 각각에 존재하는 EC2 인스턴스에 붙을 수 있다
Highly available, scalable, expensive (3x gp2), pay per use
⇒ 한번의 사용당 고가의 사용가능, 확장성, 고비용이 발생 (종량제)
Use cases: content management, web serving, data sharing, Wordpress
⇒ 사용 예 : 콘텐츠 관리, 웹 서버, 데이터 공유 등
Uses NFSv4.1 protocol
⇒ NFS v4.1 프로토콜 사용
Uses security group to control access to EFS
⇒ EFS 접근제어를 위해 security group 사용
Compatible with Linux based AMI (not Windows)
⇒ 오직 Linux베이스의 AMI에 호환된다 (윈도우 안됨)
Encryption at rest using KMS
⇒ KMS를 이용한 암호화
POSIX file system (~Linux) that has a standard file API
⇒ standard file API를 갖고 있는 POSIX 파일 시스템
File system scales automatically, pay-per-use, no capacity planning
⇒ 파일 시스템은 자동적으로 확장된다. (즉, 따로 예약되거나 설정된 용량이 없음) (종량제)
14. EFS – Performance & Storage Classes
- EFS Scale (EFS 확장성)
1000s of concurrent NFS clients, 10 GB+ /s throughput
⇒ 동시에 1000개의 NFS 클라이언트 설정 가능, 10GB/s 이상의 처리량
Grow to Petabyte-scale network file system, automatically
⇒ 자동적으로 페타바이트 스케일의 network file system로 확장됨
- Performance Mode (set at EFS creation time) (퍼포먼스 모드)
General Purpose (default) – latency-sensitive use cases (web server, CMS, etc…)
⇒ General Purpose (기본값) : 지연시간에 민감한 사용 예들 (Web 서버, CMS등)
Max I/O – higher latency, throughput, highly parallel (big data, media processing)
⇒ 최대 I/O : 고수준의 지연율, 처리량, 병렬처리(빅데이터, 미디어 프로세싱)
- 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 ⇒ 최대 3GB/s 읽기가 가능. 1GB/s 쓰기 가능
- Used for unpredictable workloads ⇒ 예측불가 workload에 사용됨
15. 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
⇒ EFS-IA : 파일 검색, 저비용으로 저장할때 사용. 라이프사이클 정책을 EFS-IA에 적용 가능
- Availability and durability (가용성 및 지속성)
Standard: Multi-AZ, great for prod
⇒ 다수의 AZ
One Zone: One AZ, great for dev, backup enabled by default, compatible with IA (EFS One Zone-IA)
⇒ 하나의 AZ. 개발용에 적합하고 백업이 기본적으로 적용됨. IA에 호환됨
Over 90% in cost savings Amazon EFS File System
⇒ Amazon EFS를 이용하여 90%이상 비용 절감
16. EBS vs EFS – Elastic Block Storage
- EBS volumes…
one instance (except multi-attach io1/io2)
⇒ 하나의 인스턴스에 적용 (multi-attach io1/io2는 제외)
are locked at the Availability Zone (AZ) level
⇒ AZ에 귀속적임
gp2: IO increases if the disk size increases
⇒ 디스크 사이즈 증가시 IO 증가
io1: can increase IO independently
⇒ IO가 독립적으로 증가
- To migrate an EBS volume across AZ (다른 AZ를 넘어서 EBS 볼륨 마이그레이션 하는 방법)
- Take a snapshot ⇒ 스냅샷 찍기
- Restore the snapshot to another AZ ⇒ 다른 AZ에 snapshot을 넣기
EBS backups use IO and you shouldn’t run them while your application is handling a lot of traffic
⇒ EBS 백업은 IO를 사용하기 때문에, 다량의 트래픽이 오고가는 어플리케이션이 기동중일때는 작동시켜서는 안된다
Root EBS Volumes of instances get terminated by default if the EC2 instance gets terminated. (you can disable that)
⇒ 인스턴스의 Root EBS 볼륨은 인스턴스 삭제시 기본적으로 같이 삭제된다
17. EBS vs EFS – Elastic File System
Mounting 100s of instances across AZ
⇒ AZ를 건너건너서 100개의 인스턴스 마운트 가능
EFS share website files (WordPress)
⇒ EFS는 웹사이트 파일을 공유한다 (WordPress)
Only for Linux Instances (POSIX)
⇒ 오직 리눅스 인스턴스에서 돌아간다 (POSIX를 사용하므로)
EFS has a higher price point than EBS
⇒ EFS는 EBS보다 더 고가의 비용이 발생한다
Can leverage EFS-IA for cost savings
⇒ EFS-IA는 비용절감에 큰 영향을 끼친다
Remember: EFS vs EBS vs Instance Store