steampipe plugin install aws

Table: aws_ebs_volume - Query AWS Elastic Block Store (EBS) using SQL

The AWS Elastic Block Store (EBS) is a high-performance block storage service designed for use with Amazon Elastic Compute Cloud (EC2) for both throughput and transaction intensive workloads at any scale. It provides persistent block-level storage volumes for use with Amazon EC2 instances. EBS volumes are highly available and reliable storage volumes that can be attached to any running instance and used like a physical hard drive.

Table Usage Guide

The aws_ebs_volume table in Steampipe provides you with information about volumes within AWS Elastic Block Store (EBS). This table allows you, as a DevOps engineer, to query volume-specific details, including size, state, type, and associated metadata. You can utilize this table to gather insights on volumes, such as their encryption status, IOPS performance, and snapshot details. The schema outlines the various attributes of the EBS volume for you, including the volume ID, creation time, attached instances, and associated tags.

Examples

List of unencrypted EBS volumes

Identify instances where EBS volumes in your AWS environment are not encrypted. This is crucial for security audits and ensuring compliance with data protection policies.

select
volume_id,
encrypted
from
aws_ebs_volume
where
not encrypted;
select
volume_id,
encrypted
from
aws_ebs_volume
where
encrypted = 0;

List of unattached EBS volumes

Identify instances where EBS volumes in AWS are not attached to any instances. This could help in optimizing resource usage and managing costs by removing unnecessary volumes.

select
volume_id,
volume_type
from
aws_ebs_volume
where
jsonb_array_length(attachments) = 0;
select
volume_id,
volume_type
from
aws_ebs_volume
where
json_array_length(attachments) = 0;

List of Provisioned IOPS SSD (io1) volumes

Determine the areas in which Provisioned IOPS SSD (io1) volumes are being used in your AWS infrastructure. This information can help optimize storage performance and costs by identifying potential areas for volume type adjustment.

select
volume_id,
volume_type
from
aws_ebs_volume
where
volume_type = 'io1';
select
volume_id,
volume_type
from
aws_ebs_volume
where
volume_type = 'io1';

List of EBS volumes with size more than 100GiB

Identify instances where AWS EBS volumes exceed 100GiB in size. This is useful to manage storage resources and prevent excessive usage.

select
volume_id,
size
from
aws_ebs_volume
where
size > '100';
select
volume_id,
size
from
aws_ebs_volume
where
size > 100;

Count the number of EBS volumes by volume type

Identify the distribution of different types of EBS volumes in your AWS environment. This helps in understanding the usage patterns and planning for cost optimization.

select
volume_type,
count(volume_type) as count
from
aws_ebs_volume
group by
volume_type;
select
volume_type,
count(volume_type) as count
from
aws_ebs_volume
group by
volume_type;

Find EBS Volumes Attached To Stopped EC2 Instances

Discover the segments that include EBS volumes attached to EC2 instances that are currently in a stopped state. This information can be beneficial to optimize resource allocation and reduce unnecessary costs.

select
volume_id,
size,
att ->> 'InstanceId' as instance_id
from
aws_ebs_volume
cross join jsonb_array_elements(attachments) as att
join aws_ec2_instance as i on i.instance_id = att ->> 'InstanceId'
where
instance_state = 'stopped';
select
volume_id,
size,
json_extract(att.value, '$.InstanceId') as instance_id
from
aws_ebs_volume
join json_each(attachments) as att
join aws_ec2_instance as i on i.instance_id = json_extract(att.value, '$.InstanceId')
where
instance_state = 'stopped';

List of Provisioned IOPS SSD (io1) volumes

Identify instances where the SSD volumes with provisioned IOPS (IO1) are being used. This could be beneficial for performance optimization and cost management.

select
volume_id,
volume_type
from
aws_ebs_volume
where
volume_type = 'io1';
select
volume_id,
volume_type
from
aws_ebs_volume
where
volume_type = 'io1';

Schema for aws_ebs_volume

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The AWS Account ID in which the resource is located.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
arntextThe Amazon Resource Name (ARN) specifying the volume.
attachmentsjsonbInformation about the volume attachments.
auto_enable_iobooleanThe state of autoEnableIO attribute.
availability_zonetext=The Availability Zone for the volume.
create_timetimestamp with time zoneThe time stamp when volume creation was initiated.
encryptedboolean=, !=Indicates whether the volume is encrypted.
fast_restoredboolean=, !=Indicates whether the volume was created using fast snapshot restore.
iopsbigintThe number of I/O operations per second (IOPS) that the volume supports.
kms_key_idtextThe Amazon Resource Name (ARN) of the AWS Key Management Service (AWS KMS) customer master key (CMK) that was used to protect the volume encryption key for the volume.
multi_attach_enabledboolean=, !=Indicates whether Amazon EBS Multi-Attach is enabled.
outpost_arntextThe Amazon Resource Name (ARN) of the Outpost.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
product_codesjsonbA list of product codes.
regiontextThe AWS Region in which the resource is located.
sizebigint=The size of the volume, in GiBs.
snapshot_idtext=The snapshot from which the volume was created, if applicable.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statetext=The volume state.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags assigned to the volume.
throughputbigintThe throughput that the volume supports, in MiB/s..
titletextTitle of the resource.
volume_idtext=The ID of the volume.
volume_typetext=The volume type. This can be gp2 for General Purpose SSD, io1 or io2 for Provisioned IOPS SSD, st1 for Throughput Optimized HDD, sc1 for Cold HDD, or standard for Magnetic volumes.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws

You can pass the configuration to the command with the --config argument:

steampipe_export_aws --config '<your_config>' aws_ebs_volume