steampipe plugin install aws

Table: aws_ec2_reserved_instance - Query AWS EC2 Reserved Instances using SQL

The AWS EC2 Reserved Instances are a type of Amazon EC2 instance that allows you to reserve compute capacity for your AWS account in a specific Availability Zone, providing a significant discount compared to On-Demand pricing. These instances are recommended for applications with steady state usage, offering up to 75% savings compared to on-demand instances. AWS EC2 Reserved Instances can be purchased with a one-time payment and used throughout the term you select.

Table Usage Guide

The aws_ec2_reserved_instance table in Steampipe provides you with information about Reserved Instances within Amazon Elastic Compute Cloud (EC2). This table allows you, as a DevOps engineer, to query reserved instance-specific details, including instance type, offering class, and state. You can utilize this table to gather insights on reserved instances, such as their configurations, reserved instance state, and associated tags. The schema outlines the various attributes of the reserved instance for you, including its ARN, instance type, offering class, and associated tags.

Examples

Basic Info

Determine the areas in which you can gain insights into your Amazon EC2 reserved instances, such as understanding the instance type, state, and costs associated with the reservation. This is useful for managing your AWS resources and optimizing your cloud cost.

select
reserved_instance_id,
arn,
instance_type,
instance_state,
currency_code,
CAST(fixed_price AS varchar),
offering_class,
scope,
CAST(usage_price AS varchar)
from
aws_ec2_reserved_instance;
select
reserved_instance_id,
arn,
instance_type,
instance_state,
currency_code,
CAST(fixed_price AS text),
offering_class,
scope,
CAST(usage_price AS text)
from
aws_ec2_reserved_instance;

Count reserved instances by instance type

Determine the number of reserved instances per type to better manage your AWS EC2 resources and optimize your cloud infrastructure.

select
instance_type,
count(instance_count) as count
from
aws_ec2_reserved_instance
group by
instance_type;
select
instance_type,
count(instance_count) as count
from
aws_ec2_reserved_instance
group by
instance_type;

List reserved instances provisioned with undesired(for example t2.large and m3.medium is desired) instance type(s)

Determine the areas in which the provisioned reserved instances are not of the desired types such as t2.large and m3.medium. This can help in optimizing resources and better cost management.

select
instance_type,
count(*) as count
from
aws_ec2_reserved_instance
where
instance_type not in ('t2.large', 'm3.medium')
group by
instance_type;
select
instance_type,
count(*) as count
from
aws_ec2_reserved_instance
where
instance_type not in ('t2.large', 'm3.medium')
group by
instance_type;

List standard offering class type reserved instances

Discover the segments that consist of standard offering class type within reserved instances in AWS EC2, which can assist in better management of resource allocation and cost optimization.

select
reserved_instance_id,
instance_type,
offering_class
from
aws_ec2_reserved_instance
where
offering_class = 'standard';
select
reserved_instance_id,
instance_type,
offering_class
from
aws_ec2_reserved_instance
where
offering_class = 'standard';

List active reserved instances

Determine the areas in which active reserved instances are being utilized within your AWS EC2 service. This can help in managing resources and optimizing costs by identifying instances that are currently in active use.

select
reserved_instance_id,
instance_type,
instance_state
from
aws_ec2_reserved_instance
where
instance_state = 'active';
select
reserved_instance_id,
instance_type,
instance_state
from
aws_ec2_reserved_instance
where
instance_state = 'active';

Schema for aws_ec2_reserved_instance

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 instance.
availability_zonetext=The Availability Zone in which the Reserved Instance can be used.
currency_codetextThe currency of the Reserved Instance. It's specified using ISO 4217 standard currency codes. At this time, the only supported currency is USD.
durationbigint=The duration of the Reserved Instance, in seconds.
end_timetimestamp with time zone=The time when the Reserved Instance expires.
fixed_pricedouble precision=The purchase price of the Reserved Instance.
instance_countbigintThe number of reservations purchased.
instance_statetext=The state of the Reserved Instance purchase.
instance_tenancytextThe tenancy of the instance.
instance_typetext=The instance type on which the Reserved Instance can be used.
offering_classtext=The offering class of the Reserved Instance.
offering_typetext=The Reserved Instance offering type.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
product_descriptiontext=The Reserved Instance product platform description.
regiontextThe AWS Region in which the resource is located.
reserved_instance_idtext=The ID of the Reserved instance.
reserved_instances_modificationsjsonbThe Reserved Instance modification information.
scopetext=The scope of the Reserved Instance.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
start_timetimestamp with time zone=The date and time the Reserved Instance started.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags assigned to the reserved instance.
titletextTitle of the resource.
usage_pricedouble precision=The usage price of the Reserved Instance, per hour.

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_ec2_reserved_instance