Skip to content

aws.ec2.describe_stale_security_groups

Example SQL Queries

SELECT * FROM
aws.ec2.describe_stale_security_groups
WHERE
"vpc_id" = 'VALUE';

Description

Describes the stale security group rules for security groups in a specified VPC. Rules are stale when they reference a deleted security group in a peered VPC. Rules can also be stale if they reference a security group in a peer VPC for which the VPC peering connection has been deleted.

Table Definition

Column NameColumn Data Type
vpc_id Required Input Column

The ID of the VPC for the security group.

VARCHAR
dry_run Input Column

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

BOOLEAN
_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
description

The description of the security group.

VARCHAR
group_id

The ID of the security group.

VARCHAR
group_name

The name of the security group.

VARCHAR
stale_ip_permissions

Information about the stale inbound rules in the security group.

STRUCT(
"from_port" BIGINT,
"ip_protocol" VARCHAR,
"ip_ranges" VARCHAR[],
"prefix_list_ids" VARCHAR[],
"to_port" BIGINT,
"user_id_group_pairs" STRUCT(
"description" VARCHAR,
"group_id" VARCHAR,
"group_name" VARCHAR,
"peering_status" VARCHAR,
"user_id" VARCHAR,
"vpc_id" VARCHAR,
"vpc_peering_connection_id" VARCHAR
)[]
)[]
Show child fields
stale_ip_permissions[]
Show child fields
stale_ip_permissions[].from_port

If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP or ICMPv6, this is the ICMP type or -1 (all ICMP types).

stale_ip_permissions[].ip_protocol

The IP protocol name (tcp, udp, icmp, icmpv6) or number (see Protocol Numbers).

stale_ip_permissions[].ip_ranges[]
stale_ip_permissions[].prefix_list_ids[]
stale_ip_permissions[].to_port

If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP or ICMPv6, this is the ICMP code or -1 (all ICMP codes).

stale_ip_permissions[].user_id_group_pairs[]
Show child fields
stale_ip_permissions[].user_id_group_pairs[].description

A description for the security group rule that references this user ID group pair.

Constraints: Up to 255 characters in length. Allowed characters are a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=;{}!$*

stale_ip_permissions[].user_id_group_pairs[].group_id

The ID of the security group.

stale_ip_permissions[].user_id_group_pairs[].group_name

[Default VPC] The name of the security group. For a security group in a nondefault VPC, use the security group ID.

For a referenced security group in another VPC, this value is not returned if the referenced security group is deleted.

stale_ip_permissions[].user_id_group_pairs[].peering_status

The status of a VPC peering connection, if applicable.

stale_ip_permissions[].user_id_group_pairs[].user_id

The ID of an Amazon Web Services account.

For a referenced security group in another VPC, the account ID of the referenced security group is returned in the response. If the referenced security group is deleted, this value is not returned.

stale_ip_permissions[].user_id_group_pairs[].vpc_id

The ID of the VPC for the referenced security group, if applicable.

stale_ip_permissions[].user_id_group_pairs[].vpc_peering_connection_id

The ID of the VPC peering connection, if applicable.

stale_ip_permissions_egress

Information about the stale outbound rules in the security group.

STRUCT(
"from_port" BIGINT,
"ip_protocol" VARCHAR,
"ip_ranges" VARCHAR[],
"prefix_list_ids" VARCHAR[],
"to_port" BIGINT,
"user_id_group_pairs" STRUCT(
"description" VARCHAR,
"group_id" VARCHAR,
"group_name" VARCHAR,
"peering_status" VARCHAR,
"user_id" VARCHAR,
"vpc_id" VARCHAR,
"vpc_peering_connection_id" VARCHAR
)[]
)[]
Show child fields
stale_ip_permissions_egress[]
Show child fields
stale_ip_permissions_egress[].from_port

If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP or ICMPv6, this is the ICMP type or -1 (all ICMP types).

stale_ip_permissions_egress[].ip_protocol

The IP protocol name (tcp, udp, icmp, icmpv6) or number (see Protocol Numbers).

stale_ip_permissions_egress[].ip_ranges[]
stale_ip_permissions_egress[].prefix_list_ids[]
stale_ip_permissions_egress[].to_port

If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP or ICMPv6, this is the ICMP code or -1 (all ICMP codes).

stale_ip_permissions_egress[].user_id_group_pairs[]
Show child fields
stale_ip_permissions_egress[].user_id_group_pairs[].description

A description for the security group rule that references this user ID group pair.

Constraints: Up to 255 characters in length. Allowed characters are a-z, A-Z, 0-9, spaces, and ._-:/()#,@[]+=;{}!$*

stale_ip_permissions_egress[].user_id_group_pairs[].group_id

The ID of the security group.

stale_ip_permissions_egress[].user_id_group_pairs[].group_name

[Default VPC] The name of the security group. For a security group in a nondefault VPC, use the security group ID.

For a referenced security group in another VPC, this value is not returned if the referenced security group is deleted.

stale_ip_permissions_egress[].user_id_group_pairs[].peering_status

The status of a VPC peering connection, if applicable.

stale_ip_permissions_egress[].user_id_group_pairs[].user_id

The ID of an Amazon Web Services account.

For a referenced security group in another VPC, the account ID of the referenced security group is returned in the response. If the referenced security group is deleted, this value is not returned.

stale_ip_permissions_egress[].user_id_group_pairs[].vpc_id

The ID of the VPC for the referenced security group, if applicable.

stale_ip_permissions_egress[].user_id_group_pairs[].vpc_peering_connection_id

The ID of the VPC peering connection, if applicable.