AWS EBS ์ด์ •๋ฆฌ

๋ธ”๋กœ๊ทธ ์˜ฎ๊ฒผ์Šต๋‹ˆ๋‹ค! ๐Ÿก’ integer.blog

EBS (Elastic Block Store)

EC2 ์ธ์Šคํ„ด์Šค์— ์žฅ์ฐฉํ•˜์—ฌ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ€์ƒ ์ €์žฅ ์žฅ์น˜.

1. ์‚ฌ์šฉ ์ด์œ 

  • ๋ฐ์ดํ„ฐ์— ๋น ๋ฅด๊ฒŒ ์•ก์„ธ์Šคํ•˜๊ณ  ์žฅ๊ธฐ์ ์œผ๋กœ ์ง€์†ํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ
  • EC2 ์ธ์Šคํ„ด์Šค์—์„œ ์ œ๊ณตํ•˜๋Š” ๊ธฐ๋ณธ ์šฉ๋Ÿ‰๋ณด๋‹ค ๋” ์‚ฌ์šฉํ•ด์•ผ ํ•  ๋•Œ
  • ์šด์˜์ฒด์ œ๋ฅผ ์ค‘๋‹จ์‹œํ‚ค์ง€ ์•Š๊ณ  ์šฉ๋Ÿ‰์„ ์ž์œ ๋กญ๊ฒŒ ๋Š˜๋ฆฌ๊ณ  ์‹ถ์„ ๋•Œ
  • ์˜๊ตฌ์ ์ธ ๋ฐ์ดํ„ฐ ๋ณด๊ด€์ด ํ•„์š”ํ•  ๋•Œ
  • RAID ๋“ฑ ๊ณ ๊ธ‰ ๊ธฐ๋Šฅ์ด ํ•„์š”ํ•  ๋•Œ

2. ์‚ฌ์šฉ ์˜ˆ์‹œ

  • ๋น…๋ฐ์ดํ„ฐ ๋ถ„์„ ์—”์ง„(ํ•˜๋‘ก/HDFS ์—์ฝ”์‹œ์Šคํ…œ, Amazon EMR ํด๋Ÿฌ์Šคํ„ฐ ๋“ฑ)
  • ๊ด€๊ณ„ํ˜• ๋ฐ NoSQL ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค
  • ์ŠคํŠธ๋ฆผ ๋ฐ ๋กœ๊ทธ ์ฒ˜๋ฆฌ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜(Kafka, Splunk ๋“ฑ)
  • ๋ฐ์ดํ„ฐ ์›จ์–ดํ•˜์šฐ์ง• ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜(Vertica, Teradata ๋“ฑ)

3. ํŠน์ง•

  • EC2์— ์„ค์น˜๋œ OS์—์„œ ์ผ๋ฐ˜์ ์ธ HDD/SDD๋กœ ์ธ์‹
  • EBS ๋ณผ๋ฅจ์€ AZ์˜ ์—ฌ๋Ÿฌ ์„œ๋ฒ„์— ์ž๋™์œผ๋กœ ๋ณต์ œ๋˜์–ด ๊ตฌ์„ฑ์š”์†Œ ์žฅ์• ๋กœ๋ถ€ํ„ฐ ๋ณดํ˜ธ
  • Provisioningํ•œ ๋ถ€๋ถ„์— ๋Œ€ํ•ด์„œ๋งŒ ๋น„์šฉ ์ง€๋ถˆ
  • ์›ํ•˜๋Š” ํฌ๊ธฐ์™€ ์„ฑ๋Šฅ(IOPS)์œผ๋กœ ์„ค์ • ๊ฐ€๋Šฅ
  • EBS ๋ณผ๋ฅจ์˜ ์‚ฌ์ด์ฆˆ์™€ ์Šคํ† ๋ฆฌ์ง€ ํƒ€์ž…์€ ์‹คํ–‰์ค‘์—๋„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค.
  • EBS ๋งˆ๊ทธ๋„คํ‹ฑ ๋ณผ๋ฅจ์€ 1GB ~ 1TB ํฌ๊ธฐ๋กœ ์ƒ์„ฑ ๊ฐ€๋Šฅ.
  • EBS General Purpose(SSD)์™€ Provisioned IOPS(SSD)๋ณผ๋ฅจ์€ 16TB ํฌ๊ธฐ๋กœ ์ƒ์„ฑ ๊ฐ€๋Šฅ
  • EC2 ์ธ์Šคํ„ด์Šค์— ๋…๋ฆฝ์ ์œผ๋กœ ์ง€์†(์ธ์Šคํ„ด์Šค๊ฐ€ stop, start, reboot ๋˜์–ด๋„ EBS๋Š” ์ง€์†๋œ๋‹ค.)
  • EC2 ์ธ์Šคํ„ด์Šค ์ข…๋ฃŒ์‹œ Root EBS๋Š” ๋””ํดํŠธ๋กœ ์‚ญ์ œ๋˜์ง€๋งŒ DeleteOnTermination flag๋กœ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.
  • EC2 ์ธ์Šคํ„ด์Šค ์ข…๋ฃŒ์‹œ ๋ชจ๋“  Attached EBS ๋ณผ๋ฅจ๋“ค์€ ์ง€์†๋œ๋‹ค.

4. EBS Encryption

  • ์•”ํ˜ธํ™”๋Š” EC2 ์ธ์Šคํ„ด์Šค๋ฅผ ํ˜ธ์ŠคํŒ…ํ•˜๋Š” ์„œ๋ฒ„์—์„œ ์ˆ˜ํ–‰๋˜๋ฏ€๋กœ EC2 ์ธ์Šคํ„ด์Šค์—์„œ EBS ์Šคํ† ๋ฆฌ์ง€๋กœ ์ „์†ก๋˜๋Š” ๋ฐ์ดํ„ฐ๊ฐ€ ์•”ํ˜ธํ™”๋œ๋‹ค.
  • ์•”ํ˜ธํ™”๋Š” AES-256์™€ AMS Key Management Service (AWS KMS)์˜ Customer Master Keys(CMK) ์‚ฌ์šฉ
  • ๋ชจ๋“  EBS ๋ณผ๋ฅจ ํƒ€์ž…์€ ์•”ํ˜ธํ™” ๊ฐ€๋Šฅ
  • ์•”ํ˜ธํ™”๋œ ๋ณผ๋ฅจ์˜ ์Šค๋ƒ…์ƒท๊ณผ ์•”ํ˜ธํ™”๋œ ์Šค๋ƒ…์ƒท์—์„œ ์ƒ์„ฑ๋œ ๋ณผ๋ฅจ์€ ๊ฐ™์€ ๋ณผ๋ฅจ ์•”ํ˜ธํ‚ค๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ž๋™์œผ๋กœ ์•”ํ˜ธํ™”๋œ๋‹ค.
  • ์กด์žฌํ•˜๋Š” ์•”ํ˜ธํ™”๋˜์ง€ ์•Š์€ ๋ณผ๋ฅจ์€ ๋ฐ”๋กœ ์•”ํ˜ธํ™” ํ•  ์ˆ˜ ์—†๋‹ค. ๋Œ€์‹  ์•„๋ž˜ 3๊ฐ€์ง€ ๊ฒฝ์šฐ์— ๊ฐ€๋Šฅํ•˜๋‹ค.
    1. ๋ณผ๋ฅจ์œผ๋กœ๋ถ€ํ„ฐ ์•”ํ˜ธํ™”๋˜์ง€ ์•Š์€ ์Šค๋ƒ…์ƒท์„ ์ƒ์„ฑ
    2. ์•”ํ˜ธํ™”๋˜์ง€ ์•Š์€ ์Šค๋ƒ…์…˜์˜ ์•”ํ˜ธํ™”๋œ ๋ณต์‚ฌ๋ณธ์„ ์ƒ์„ฑ
    3. ์•”ํ˜ธํ™”๋œ ์Šค๋ƒ…์ƒท์œผ๋กœ๋ถ€ํ„ฐ ์•”ํ˜ธํ™”๋œ ๋ณผ๋ฅจ์„ ์ƒ์„ฑ
  • ์•”ํ˜ธํ™”๋œ ์Šค๋ƒ…์ƒท์€ unencrypted ์Šค๋ƒ…์ƒท์˜ ์•”ํ˜ธํ™”๋œ ๋ณต์‚ฌ๋ณธ์„ ๋งŒ๋“ฆ์œผ๋กœ์จ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ์•”ํ˜ธํ™”๋œ ๋ณผ๋ฅจ์œผ๋กœ unencrypted ๋ณผ๋ฅจ์„ ๋ฐ”๋กœ ๋งŒ๋“ค์ˆ˜ ์—†๊ณ , ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด ํ•„์š”ํ•˜๋‹ค.
  • ์•”ํ˜ธํ™”๋œ ๋ณผ๋ฅจ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๊ณต์œ ํ•˜๋ ค๋ฉด, ๋ฐ์ดํ„ฐ๋ฅผ unencrypted ๋ณผ๋ฅจ์œผ๋กœ ๋ณต์‚ฌํ•˜๊ณ  ๊ณต์œ ํ•˜๋ฉด ๋œ๋‹ค.

5. EBS Snapshot

  • ๋ณผ๋ฅจ์€ EBS์— ์กด์žฌํ•˜๊ณ  Snapshot์€ S3์— ์กด์žฌํ•œ๋‹ค.
  • EBS ์Šค๋ƒ…์ƒท์œผ๋กœ EBS ๋ณผ๋ฅจ๊ณผ EC2 ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋Š” AMI๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.
  • AMI๋Š” EBS-backed ์ธ์Šคํ„ด์Šค์™€ ์Šค๋ƒ…์ƒท ๋ชจ๋‘์—์„œ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.
  • EBS ๋ณผ๋ฅจ ์ž์ฒด๋กœ๋Š” ๋‹ค๋ฅธ AZ๋กœ ์ด์ „ํ•  ์ˆ˜ ์—†์œผ๋ฏ€๋กœ EBS ์Šค๋ƒ…์ƒท์„ ํ™œ์šฉํ•ด์•ผ ํ•œ๋‹ค.
  • EBS ์Šค๋ƒ…์ƒท์€ S3์— ์ €์žฅ๋˜์–ด ๋ฐฑ์—…๋œ๋‹ค.
  • EBS ์Šค๋ƒ…์ƒท์€ S3์— ์ €์žฅ๋˜๋ฉด์„œ ์••์ถ•๋˜์–ด์„œ EBS ์Šค๋ƒ…์ƒท์˜ ์‚ฌ์ด์ฆˆ๋Š” ๋ณผ๋ฅจ ์‚ฌ์ด์ฆˆ๋ณด๋‹ค ์ž‘๋‹ค.
  • To create a snapshot for EBS volumes that serve as root devices, yout should stop the instance before taking the snapshot
  • However you can take a snap while the instance is running
  • ์•”ํ˜ธํ™”๋œ ์Šค๋ƒ…์ƒท์€ ๊ณต์œ ํ•  ์ˆ˜ ์—†๋‹ค.
  • ์Šค๋ƒ…์ƒท์€ ๋‹ค๋ฅธ AWS ๊ณ„์ •์œผ๋กœ ๊ณต์œ ํ•˜๊ฑฐ๋‚˜ Public์œผ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.

6. EBS Performance

  • ์ƒˆ๋กœ ๋งŒ๋“ค์–ด์ง„ EBS ๋ณผ๋ฅจ์€ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ˆœ๊ฐ„์— ์ตœ๋Œ€ ์„ฑ๋Šฅ์„ ๋‚ด๊ณ , initialization์ด ํ•„์š”์—†๋‹ค.(pre-warming)
  • RAID 0
    • ์ž…์ถœ๋ ฅ ์„ฑ๋Šฅ์ด ์•ˆ์ •์„ฑ๋ณด๋‹ค ๋” ์ค‘์š”ํ•  ๋•Œ ์‚ฌ์šฉ
    • (์žฅ์ ) ์ž…์ถœ๋ ฅ์ด stripe ๋‚ด์˜ ๋ณผ๋ฅจ๋“ค์— ๋ถ„์‚ฐ๋œ๋‹ค.
    • (์žฅ์ ) ๋ณผ๋ฅจ์„ ํ•˜๋‚˜ ์ถ”๊ฐ€ํ•˜๋ฉด ๊ทธ ์ฆ‰์‹œ throughput์˜ ์ถ”๊ฐ€์™€ ๊ฐ™๋‹ค.
    • (๋‹จ์ ) ๊ฐ€์žฅ performance๊ฐ€ ๋‚ฎ์€ ๋ณผ๋ฅจ์„ ๊ธฐ์ค€์œผ๋กœ stripe์˜ performance๊ฐ€ ์ œํ•œ๋œ๋‹ค.
    • (๋‹จ์ ) ํ•œ ๋ณผ๋ฅจ์˜ ์†์‹ค์€ ๋ฐ์ดํ„ฐ ์†์‹ค์„ ์˜๋ฏธํ•œ๋‹ค.
  • RAID 1
    • ์•ˆ์ •์„ฑ์ด ์ž…์ถœ๋ ฅ ์„ฑ๋Šฅ๋ณด๋‹ค ์ค‘์š”ํ•  ๋•Œ ์‚ฌ์šฉ
    • (์žฅ์ ) ๋ฐ์ดํ„ฐ ์ง€์†์„ฑ ์ธก๋ฉด์—์„œ ์•ˆ์ „ํ•˜๋‹ค.
    • (๋‹จ์ ) ๋ฐ์ดํ„ฐ๊ฐ€ ์—ฌ๋Ÿฌ ๋ณผ๋ฅจ์— ๋™์‹œ์— ์ž‘์„ฑ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์“ฐ๊ธฐ ๋Šฅ๋ ฅ์„ ํ–ฅ์ƒ์‹œํ‚ค๋ ค๋ฉด non-RAID ์„ค์ •์— ๋น„ํ•ด EC2์™€ EBS ์‚ฌ์ด์— ๋” ํฐ ๋Œ€์—ญํญ์ด ํ•„์š”ํ•˜๋‹ค.

7. ๋” ์ž์„ธํ•œ ํ•™์Šต

*์–ด๋ ค์šด ๋ฌธ์ œ๋“ค

  1. You are running a database on an EC2 instance, with the data stored on Elastic Block Store (EBS) for persistence At times throughout the day, you are seeing large variance in the response times of the database queries Looking into the instance with the isolate command you see a lot of wait time on the disk volume that the databaseโ€™s data is stored on. What two ways can you improve the performance of the databaseโ€™s storage while maintaining the current persistence of the data? Choose 2 answers

    a. Move to an SSD backed instance
    b. Move the database to an EBS-Optimized Instance
    c. Use Provisioned IOPs EBS
    d. Use the ephemeral storage on an m2.4xLarge Instance Instead

  2. A user has created numerous EBS volumes. What is the general limit for each AWS account for the maximum number of EBS volumes that can be created?

    a. 10000
    b. 5000
    c. 100
    d. 1000

  3. If an Amazon EBS volume is the root device of an instance, can I detach it without stopping the instance?

    a. Yes but only if Windows instance
    b. No
    c. Yes
    d. Yes but only if a Linux instance

  4. Can we attach an EBS volume to more than one EC2 instance at the same time?

    a. Yes
    b. No
    c. Only EC2-optimized EBS volumes.
    d. Only in read mode.

  5. Do the Amazon EBS volumes persist independently from the running life of an Amazon EC2 instance?

    a. Only if instructed to when created
    b. Yes
    c. No

  6. Can I delete a snapshot of the root device of an EBS volume used by a registered AMI?

    a. Only via API
    b. Only via Console
    c. Yes
    d. No

  7. Your company policies require encryption of sensitive data at rest. You are considering the possible options for protecting data while storing it at rest on an EBS data volume, attached to an EC2 instance. Which of these options would allow you to encrypt your data at rest? (Choose 3 answers)

    a. Implement third party volume encryption tools
    b. Do nothing as EBS volumes are encrypted by default
    c. Encrypt data inside your applications before storing it on EBS
    d. Encrypt data using native data encryption drivers at the file system level
    e. Implement SSL/TLS for all services running on the server

  8. A user is planning to schedule a backup for an EBS volume. The user wants security of the snapshot data. How can the user achieve data encryption with a snapshot?

    a. Use encrypted EBS volumes so that the snapshot will be encrypted by AWS
    b. While creating a snapshot select the snapshot with encryption
    c. By default the snapshot is encrypted by AWS
    d. Enable server side encryption for the snapshot using S3

  9. A user is planning to use EBS for his DB requirement. The user already has an EC2 instance running in the VPC private subnet. How can the user attach the EBS volume to a running instance?

    a. The user must create EBS within the same VPC and then attach it to a running instance.
    b. The user can create EBS in the same zone as the subnet of instance and attach that EBS to instance. (Should be in the same AZ)
    c. It is not possible to attach an EBS to an instance running in VPC until the instance is stopped.
    d. The user can specify the same subnet while creating EBS and then attach it to a running instance.

*Reference