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 countfrom aws_ec2_reserved_instancegroup by instance_type;
select instance_type, count(instance_count) as countfrom aws_ec2_reserved_instancegroup 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 countfrom aws_ec2_reserved_instancewhere instance_type not in ('t2.large', 'm3.medium')group by instance_type;
select instance_type, count(*) as countfrom aws_ec2_reserved_instancewhere 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_classfrom aws_ec2_reserved_instancewhere offering_class = 'standard';
select reserved_instance_id, instance_type, offering_classfrom aws_ec2_reserved_instancewhere 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_statefrom aws_ec2_reserved_instancewhere instance_state = 'active';
select reserved_instance_id, instance_type, instance_statefrom aws_ec2_reserved_instancewhere instance_state = 'active';
Schema for aws_ec2_reserved_instance
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
arn | text | The Amazon Resource Name (ARN) specifying the instance. | |
availability_zone | text | = | The Availability Zone in which the Reserved Instance can be used. |
currency_code | text | The currency of the Reserved Instance. It's specified using ISO 4217 standard currency codes. At this time, the only supported currency is USD. | |
duration | bigint | = | The duration of the Reserved Instance, in seconds. |
end_time | timestamp with time zone | = | The time when the Reserved Instance expires. |
fixed_price | double precision | = | The purchase price of the Reserved Instance. |
instance_count | bigint | The number of reservations purchased. | |
instance_state | text | = | The state of the Reserved Instance purchase. |
instance_tenancy | text | The tenancy of the instance. | |
instance_type | text | = | The instance type on which the Reserved Instance can be used. |
offering_class | text | = | The offering class of the Reserved Instance. |
offering_type | text | = | The Reserved Instance offering type. |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
product_description | text | = | The Reserved Instance product platform description. |
region | text | The AWS Region in which the resource is located. | |
reserved_instance_id | text | = | The ID of the Reserved instance. |
reserved_instances_modifications | jsonb | The Reserved Instance modification information. | |
scope | text | = | The scope of the Reserved Instance. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
start_time | timestamp with time zone | = | The date and time the Reserved Instance started. |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | A list of tags assigned to the reserved instance. | |
title | text | Title of the resource. | |
usage_price | double 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