steampipe plugin install aws

Table: aws_ec2_capacity_reservation - Query AWS EC2 Capacity Reservations using SQL

An AWS EC2 Capacity Reservation ensures that you have reserved capacity for your Amazon EC2 instances in a specific Availability Zone for any duration. This capacity reservation helps to reduce the risks of insufficient capacity for launching instances into an Availability Zone, providing predictable instance launch times. It's a useful tool for capacity planning and managing costs, particularly for applications with predictable peaks in demand.

Table Usage Guide

The aws_ec2_capacity_reservation table in Steampipe provides you with information about Capacity Reservations within AWS Elastic Compute Cloud (EC2). This table allows you, as a DevOps engineer, to query reservation-specific details, including reservation ID, reservation ARN, state, instance type, and associated metadata. You can utilize this table to gather insights on reservations, such as reservations per availability zone, reservations per instance type, and more. The schema outlines for you the various attributes of the EC2 Capacity Reservation, including the reservation ID, creation date, instance count, and associated tags.

Examples

Basic info

Identify instances where Amazon EC2 capacity reservations are made, gaining insights into the type of instances reserved and their current state. This can help in efficiently managing resources and understanding reservation patterns.

select
capacity_reservation_id,
capacity_reservation_arn,
instance_type,
state
from
aws_ec2_capacity_reservation;
select
capacity_reservation_id,
capacity_reservation_arn,
instance_type,
state
from
aws_ec2_capacity_reservation;

List EC2 expired capacity reservations

Identify instances where Amazon EC2 capacity reservations have expired. This information can be useful in managing resources and potentially freeing up unused capacity.

select
capacity_reservation_id,
capacity_reservation_arn,
instance_type,
state
from
aws_ec2_capacity_reservation
where
state = 'expired';
select
capacity_reservation_id,
capacity_reservation_arn,
instance_type,
state
from
aws_ec2_capacity_reservation
where
state = 'expired';

Get EC2 capacity reservation by ID

Determine the status and type of a specific EC2 capacity reservation in AWS, which can be useful for managing and optimizing resource allocation.

select
capacity_reservation_id,
capacity_reservation_arn,
instance_type,
state
from
aws_ec2_capacity_reservation
where
capacity_reservation_id = 'cr-0b30935e9fc2da81e';
select
capacity_reservation_id,
capacity_reservation_arn,
instance_type,
state
from
aws_ec2_capacity_reservation
where
capacity_reservation_id = 'cr-0b30935e9fc2da81e';

Schema for aws_ec2_capacity_reservation

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.
availability_zonetext=The availability zone in which the capacity is reserved.
availability_zone_idtext=The availability zone ID of the capacity reservation.
available_instance_countbigintThe remaining capacity. Indicates the number of instances that can be launched in the capacity reservation.
capacity_allocationsjsonbInformation about instance capacity usage.
capacity_reservation_arntextThe Amazon Resource Name (ARN) of the capacity reservation.
capacity_reservation_fleet_idtextThe ID of the Capacity Reservation Fleet to which the Capacity Reservation belongs. Only valid for Capacity Reservations that were created by a Capacity Reservation Fleet.
capacity_reservation_idtext=The ID of the capacity reservation.
create_datetimestamp with time zoneThe date and time at which the capacity reservation was created.
ebs_optimizedbooleanIndicates whether the capacity reservation supports EBS-optimized instances.
end_datetimestamp with time zone=The date and time at which the capacity reservation expires.
end_date_typetext=Indicates the way in which the capacity reservation ends. A capacity reservation can have one of the following end types: 'unlimited', 'limited'.
ephemeral_storagebooleanIndicates whether the capacity reservation supports instances with temporary, block-level storage.
instance_match_criteriatext=Indicates the type of instance launches that the capacity reservation accepts. The options include: 'open', 'targeted'.
instance_platformtext=The type of operating system for which the capacity reservation reserves capacity.
instance_typetext=The type of instance for which the capacity reservation reserves capacity.
outpost_arntextThe Amazon Resource Name (ARN) of the Outpost on which the Capacity Reservation was created.
owner_idtext=The ID of the AWS account that owns the capacity reservation.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
placement_group_arntextThe Amazon Resource Name (ARN) of the cluster placement group in which the Capacity Reservation was created.
regiontextThe AWS Region in which the resource is located.
reservation_typetextThe type of Capacity Reservation.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
start_datetimestamp with time zone=The date and time at which the capacity reservation was started.
statetext=The current state of the capacity reservation. A capacity reservation can be in one of the following states: 'active', 'expired', 'cancelled', 'pending', 'failed'.
tag_srcjsonbAny tags assigned to the capacity reservation.
tagsjsonbA map of tags for the resource.
tenancytext=Indicates the tenancy of the capacity reservation. A capacity reservation can have one of the following tenancy settings: 'default', 'dedicated'.
titletextTitle of the resource.
total_instance_countbigintThe total number of instances for which the capacity reservation reserves capacity.

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_capacity_reservation