steampipe plugin install aws

Table: aws_cloudformation_stack_resource - Query AWS CloudFormation Stack Resources using SQL

The AWS CloudFormation Stack Resources are the AWS resources that are part of a stack. AWS CloudFormation simplifies the process of managing your AWS resources by treating all the resources as a single unit, called a stack. These resources can be created, updated, or deleted in a single operation, making it easier to manage and configure all the resources collectively.

Table Usage Guide

The aws_cloudformation_stack_resource table in Steampipe provides you with information about Stack Resources within AWS CloudFormation. This table allows you, as a DevOps engineer, to query resource-specific details, including the current status, resource type, and associated metadata. You can utilize this table to gather insights on resources, such as resource status, the type of resources used in the stack, and more. The schema outlines the various attributes of the Stack Resource for you, including the stack name, resource status, logical resource id, and physical resource id.

Examples

Basic info

Explore the status and type of resources within your AWS CloudFormation stack to better understand your stack's configuration and resource allocation. This allows for effective resource management and helps identify potential issues in your stack's setup.

select
stack_name,
stack_id,
logical_resource_id,
resource_type,
resource_status
from
aws_cloudformation_stack_resource;
select
stack_name,
stack_id,
logical_resource_id,
resource_type,
resource_status
from
aws_cloudformation_stack_resource;

List cloudformation stack resources having rollback disabled

Determine the areas in your AWS CloudFormation setup where rollback is disabled, allowing you to understand potential risk points in your infrastructure. This can be useful in identifying instances where a failure in stack creation or update could lead to resource inconsistencies.

select
s.name,
s.disable_rollback,
r.logical_resource_id,
r.resource_status
from
aws_cloudformation_stack_resource as r,
aws_cloudformation_stack as s
where
r.stack_id = s.id
and s.disable_rollback;
select
s.name,
s.disable_rollback,
r.logical_resource_id,
r.resource_status
from
aws_cloudformation_stack_resource as r
join aws_cloudformation_stack as s on r.stack_id = s.id
where
s.disable_rollback = 1;

List resources having termination protection disabled

Determine the areas in which resources could be at risk due to disabled termination protection. This is useful for identifying potential vulnerabilities within your CloudFormation stacks.

select
s.name,
s.enable_termination_protection,
s.disable_rollback,
r.logical_resource_id,
r.resource_status
from
aws_cloudformation_stack_resource as r,
aws_cloudformation_stack as s
where
r.stack_id = s.id
and not enable_termination_protection;
select
s.name,
s.enable_termination_protection,
s.disable_rollback,
r.logical_resource_id,
r.resource_status
from
aws_cloudformation_stack_resource as r
join aws_cloudformation_stack as s on r.stack_id = s.id
where
not s.enable_termination_protection;

List stack resources of type VPC

Discover the segments that are utilizing Virtual Private Cloud (VPC) resources within your AWS CloudFormation stacks. This is useful for understanding your resource allocation and identifying any potential areas of optimization.

select
stack_name,
stack_id,
logical_resource_id,
resource_status,
resource_type
from
aws_cloudformation_stack_resource
where
resource_type = 'AWS::EC2::VPC';
select
stack_name,
stack_id,
logical_resource_id,
resource_status,
resource_type
from
aws_cloudformation_stack_resource
where
resource_type = 'AWS::EC2::VPC';

List resources that failed to update

Identify instances where updates to cloud resources failed. This can help in troubleshooting and rectifying issues to ensure smooth operation of your cloud infrastructure.

select
stack_name,
logical_resource_id,
resource_status,
resource_type
from
aws_cloudformation_stack_resource
where
resource_status = 'UPDATE_FAILED';
select
stack_name,
logical_resource_id,
resource_status,
resource_type
from
aws_cloudformation_stack_resource
where
resource_status = 'UPDATE_FAILED';

Schema for aws_cloudformation_stack_resource

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The AWS Account ID in which the resource is located.
descriptiontextUser defined description associated with the resource.
drift_informationjsonbInformation about whether the resource's actual configuration differs, or has drifted, from its expected configuration, as defined in the stack template and any values specified as template parameters. For more information, see Detecting Unregulated Configuration Changes to Stacks and Resources.
last_updated_timestamptimestamp with time zoneTime the status was updated.
logical_resource_idtext=The logical name of the resource specified in the template.
module_infojsonbContains information about the module from which the resource was created, if the resource was created from a module included in the stack template.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
physical_resource_idtextThe name or unique identifier that corresponds to a physical instance ID of a resource supported by CloudFormation.
regiontextThe AWS Region in which the resource is located.
resource_statustextCurrent status of the resource.
resource_status_reasontextSuccess/failure message associated with the resource.
resource_typetextType of resource.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
stack_idtextUnique identifier of the stack.
stack_nametext=The name associated with the stack.
titletextTitle of the resource.

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_cloudformation_stack_resource