CloudWiki
Resource

EBS Volume

Amazon Web Services
Storage
An EBS volume is a flexible block-level storage that can be mounted to devices on EC2 instances. Once mounted, it can be formatted with a file system, host operating systems and applications, and have snapshots or clones made from it.
Terraform Name
terraform
aws_ebs_volume
EBS Volume
attributes:
  • availability_zone - (Required) The AZ where the EBS volume will exist.
  • encrypted - (Optional) If true, the disk will be encrypted.
  • final_snapshot - (Optional) If true, snapshot will be created before volume deletion. Any tags on the volume will be migrated to the snapshot. By default set to false
  • iops - (Optional) The amount of IOPS to provision for the disk. Only valid for type of io1, io2 or gp3.
  • multi_attach_enabled - (Optional) Specifies whether to enable Amazon EBS Multi-Attach. Multi-Attach is supported on io1 and io2 volumes.
  • size - (Optional) The size of the drive in GiBs.
  • snapshot_id (Optional) A snapshot to base the EBS volume off of.
  • outpost_arn - (Optional) The Amazon Resource Name (ARN) of the Outpost.
  • type - (Optional) The type of EBS volume. Can be standard, gp2, gp3, io1, io2, sc1 or st1 (Default: gp2).
  • kms_key_id - (Optional) The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true. Note: Terraform must be running with credentials which have the GenerateDataKeyWithoutPlaintext permission on the specified KMS key as required by the EBS KMS CMK volume provisioning process to prevent a volume from being created and almost immediately deleted.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
  • throughput - (Optional) The throughput that the volume supports, in MiB/s. Only valid for type of gp3.
Associating resources with a
EBS Volume
Resources do not "belong" to a
EBS Volume
Rather, one or more Security Groups are associated to a resource.
Create
EBS Volume
via Terraform:
The following HCL creates an EBS volume with tags
Syntax:

resource "aws_ebs_volume" "example" {
 availability_zone = "us-west-2a"
 size              = 40
 tags = {
   Name = "HelloWorld"
 }
}

Create
EBS Volume
via CLI:
Parameters:

create-volume
--availability-zone <value>
[--encrypted | --no-encrypted]
[--iops <value>]
[--kms-key-id <value>]
[--outpost-arn <value>]
[--size <value>]
[--snapshot-id <value>]
[--volume-type <value>]
[--dry-run | --no-dry-run]
[--tag-specifications <value>]
[--multi-attach-enabled | --no-multi-attach-enabled]
[--throughput <value>]
[--client-token <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]

Example:

aws ec2 create-volume \
   --availability-zone us-east-1a \
   --volume-type gp2 \
   --size 80 \
   --tag-specifications 'ResourceType=volume,Tags=[{Key=purpose,Value=production},{Key=cost-center,Value=cc123}]'

aws cost
Costs
The cost of using EBS Volumes depends on several factors, including the volume type, the amount of storage used, and the amount of data transfer. For volume types, you are charged based on the hourly rate for the volume type you choose. The cost of volume types varies depending on the region you are using. For storage, you are charged based on the amount of data stored in your EBS volumes. The cost of storage varies depending on the region you are using. For data transfer, you are charged based on the amount of data transferred in and out of your EBS volumes. The cost of data transfer varies depending on the region you are using.
Direct Cost

<Region>-EBS:VolumeUsage.gp2

<Region>-EBS:VolumeUsage.gp3

EBS:VolumeP-Throughput.gp3

EBS:VolumeP-IOPS.gp3

EBS:VolumeUsage.piops

EBS:VolumeP-IOPS.piops


Indirect Cost
No items found.
Best Practices for
EBS Volume

Categorized by Availability, Security & Compliance and Cost

Low
Access allowed from VPN
No items found.
Low
Auto Scaling Group not in use
No items found.
Medium
Connections towards DynamoDB should be via VPC endpoints
No items found.
Medium
Container in CrashLoopBackOff state
No items found.
Low
EC2 with GPU capabilities
No items found.
Medium
EC2 with high privileged policies
No items found.
Medium
ECS cluster delete alarm
No items found.
Critical
ECS task with Admin access (*:*)
Medium
ECS task with high privileged policies
No items found.
Critical
EKS cluster delete alarm
No items found.
Medium
ElastiCache cluster delete alarm
No items found.
Medium
Ensure Container liveness probe is configured
No items found.
Medium
Ensure ECS task definition has memory limit
No items found.
Critical
Ensure EMR cluster master nodes are not publicly accessible
No items found.
More from
Amazon Web Services