Skip to content

aws.cloudformation.describe_stack_resources

Example SQL Queries

SELECT * FROM
aws.cloudformation.describe_stack_resources;

Description

Returns Amazon Web Services resource descriptions for running and deleted stacks. If StackName is specified, all the associated resources that are part of the stack are returned. If PhysicalResourceId is specified, the associated resources of the stack that the resource belongs to are returned.

Only the first 100 resources will be returned. If your stack has more resources than this, you should use ListStackResources instead.

For deleted stacks, DescribeStackResources returns resource information for up to 90 days after the stack has been deleted.

You must specify either StackName or PhysicalResourceId, but not both. In addition, you can specify LogicalResourceId to filter the returned result. For more information about resources, the LogicalResourceId and PhysicalResourceId, go to the CloudFormation User Guide.

A ValidationError is returned if you specify both StackName and PhysicalResourceId in the same request.

Table Definition

Column NameColumn Data Type
logical_resource_id Input Column

The logical name of the resource as specified in the template.

Default: There is no default value.

VARCHAR
physical_resource_id Input Column

The name or unique identifier that corresponds to a physical instance ID of a resource supported by CloudFormation.

For example, for an Amazon Elastic Compute Cloud (EC2) instance, PhysicalResourceId corresponds to the InstanceId. You can pass the EC2 InstanceId to DescribeStackResources to find which stack the instance belongs to and what other resources are part of the stack.

Required: Conditional. If you don't specify PhysicalResourceId, you must specify StackName.

Default: There is no default value.

VARCHAR
stack_name Input Column

The name or the unique stack ID that is associated with the stack, which aren't always interchangeable:

  • Running stacks: You can specify either the stack's name or its unique stack ID.

  • Deleted stacks: You must specify the unique stack ID.

Default: There is no default value.

Required: Conditional. If you don't specify StackName, you must specify PhysicalResourceId.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

_aws_region Input Column

The AWS region to use.

VARCHAR
stack_resources

A list of StackResource structures.

STRUCT(
"stack_name" VARCHAR,
"stack_id" VARCHAR,
"logical_resource_id" VARCHAR,
"physical_resource_id" VARCHAR,
"resource_type" VARCHAR,
"timestamp" TIMESTAMP_S,
"resource_status" VARCHAR,
"resource_status_reason" VARCHAR,
"description" VARCHAR,
"drift_information" STRUCT(
"stack_resource_drift_status" VARCHAR,
"last_check_timestamp" TIMESTAMP_S
),
"module_info" STRUCT(
"type_hierarchy" VARCHAR,
"logical_id_hierarchy" VARCHAR
)
)[]
Show child fields
stack_resources[]
Show child fields
stack_resources[].description

User defined description associated with the resource.

stack_resources[].drift_information

Information 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.

Show child fields
stack_resources[].drift_information.last_check_timestamp

When CloudFormation last checked if the resource had drifted from its expected configuration.

stack_resources[].drift_information.stack_resource_drift_status

Status of the resource's actual configuration compared to its expected configuration

  • DELETED: The resource differs from its expected configuration in that it has been deleted.

  • MODIFIED: The resource differs from its expected configuration.

  • NOT_CHECKED: CloudFormation has not checked if the resource differs from its expected configuration.

    Any resources that do not currently support drift detection have a status of NOT_CHECKED. For more information, see Resources that Support Drift Detection.

  • IN_SYNC: The resource's actual configuration matches its expected configuration.

stack_resources[].logical_resource_id

The logical name of the resource specified in the template.

stack_resources[].module_info

Contains information about the module from which the resource was created, if the resource was created from a module included in the stack template.

Show child fields
stack_resources[].module_info.logical_id_hierarchy

A concatenated list of the logical IDs of the module or modules containing the resource. Modules are listed starting with the inner-most nested module, and separated by /.

In the following example, the resource was created from a module, moduleA, that's nested inside a parent module, moduleB.

moduleA/moduleB

For more information, see Referencing resources in a module in the CloudFormation User Guide.

stack_resources[].module_info.type_hierarchy

A concatenated list of the module type or types containing the resource. Module types are listed starting with the inner-most nested module, and separated by /.

In the following example, the resource was created from a module of type AWS::First::Example::MODULE, that's nested inside a parent module of type AWS::Second::Example::MODULE.

AWS::First::Example::MODULE/AWS::Second::Example::MODULE

stack_resources[].physical_resource_id

The name or unique identifier that corresponds to a physical instance ID of a resource supported by CloudFormation.

stack_resources[].resource_status

Current status of the resource.

stack_resources[].resource_status_reason

Success/failure message associated with the resource.

stack_resources[].resource_type

Type of resource. For more information, go to Amazon Web Services Resource Types Reference in the CloudFormation User Guide.

stack_resources[].stack_id

Unique identifier of the stack.

stack_resources[].stack_name

The name associated with the stack.

stack_resources[].timestamp

Time the status was updated.