Skip to content

aws.ec2.describe_security_groups

Example SQL Queries

SELECT * FROM
aws.ec2.describe_security_groups;

Description

Describes the specified security groups or all of your security groups.

Table Definition

Column NameColumn Data Type
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
filters Input Column

The filters. If using multiple filters for rules, the results include security groups for which any combination of rules - not necessarily a single rule - match all filters.

  • description - The description of the security group.

  • egress.ip-permission.cidr - An IPv4 CIDR block for an outbound security group rule.

  • egress.ip-permission.from-port - For an outbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.

  • egress.ip-permission.group-id - The ID of a security group that has been referenced in an outbound security group rule.

  • egress.ip-permission.group-name - The name of a security group that is referenced in an outbound security group rule.

  • egress.ip-permission.ipv6-cidr - An IPv6 CIDR block for an outbound security group rule.

  • egress.ip-permission.prefix-list-id - The ID of a prefix list to which a security group rule allows outbound access.

  • egress.ip-permission.protocol - The IP protocol for an outbound security group rule (tcp | udp | icmp, a protocol number, or -1 for all protocols).

  • egress.ip-permission.to-port - For an outbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.

  • egress.ip-permission.user-id - The ID of an Amazon Web Services account that has been referenced in an outbound security group rule.

  • group-id - The ID of the security group.

  • group-name - The name of the security group.

  • ip-permission.cidr - An IPv4 CIDR block for an inbound security group rule.

  • ip-permission.from-port - For an inbound rule, the start of port range for the TCP and UDP protocols, or an ICMP type number.

  • ip-permission.group-id - The ID of a security group that has been referenced in an inbound security group rule.

  • ip-permission.group-name - The name of a security group that is referenced in an inbound security group rule.

  • ip-permission.ipv6-cidr - An IPv6 CIDR block for an inbound security group rule.

  • ip-permission.prefix-list-id - The ID of a prefix list from which a security group rule allows inbound access.

  • ip-permission.protocol - The IP protocol for an inbound security group rule (tcp | udp | icmp, a protocol number, or -1 for all protocols).

  • ip-permission.to-port - For an inbound rule, the end of port range for the TCP and UDP protocols, or an ICMP code.

  • ip-permission.user-id - The ID of an Amazon Web Services account that has been referenced in an inbound security group rule.

  • owner-id - The Amazon Web Services account ID of the owner of the security group.

  • tag:<key> - The key/value combination of a tag assigned to the resource. Use the tag key in the filter name and the tag value as the filter value. For example, to find all resources that have a tag with the key Owner and the value TeamA, specify tag:Owner for the filter name and TeamA for the filter value.

  • tag-key - The key of a tag assigned to the resource. Use this filter to find all resources assigned a tag with a specific key, regardless of the tag value.

  • vpc-id - The ID of the VPC specified when the security group was created.

STRUCT(
"name" VARCHAR,
"values" VARCHAR[]
)[]
Show child fields
filters[]
Show child fields
filters[].name

The name of the filter. Filter names are case-sensitive.

filters[].values[]
group_ids Input Column

The IDs of the security groups. Required for security groups in a nondefault VPC.

Default: Describes all of your security groups.

VARCHAR[]
Show child fields
group_ids[]
group_names Input Column

[Default VPC] The names of the security groups. You can specify either the security group name or the security group ID.

Default: Describes all of your security groups.

VARCHAR[]
Show child fields
group_names[]
_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

A description of the security group.

VARCHAR
group_id

The ID of the security group.

VARCHAR
group_name

The name of the security group.

VARCHAR
ip_permissions

The inbound rules associated with the security group.

STRUCT(
"from_port" BIGINT,
"ip_protocol" VARCHAR,
"ip_ranges" STRUCT(
"cidr_ip" VARCHAR,
"description" VARCHAR
)[],
"ipv6_ranges" STRUCT(
"cidr_ipv6" VARCHAR,
"description" VARCHAR
)[],
"prefix_list_ids" STRUCT(
"description" VARCHAR,
"prefix_list_id" 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
ip_permissions[]
Show child fields
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).

ip_permissions[].ip_protocol

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

Use -1 to specify all protocols. When authorizing security group rules, specifying -1 or a protocol number other than tcp, udp, icmp, or icmpv6 allows traffic on all ports, regardless of any port range you specify. For tcp, udp, and icmp, you must specify a port range. For icmpv6, the port range is optional; if you omit the port range, traffic for all types and codes is allowed.

ip_permissions[].ip_ranges[]
Show child fields
ip_permissions[].ip_ranges[].cidr_ip

The IPv4 address range. You can either specify a CIDR block or a source security group, not both. To specify a single IPv4 address, use the /32 prefix length.

ip_permissions[].ip_ranges[].description

A description for the security group rule that references this IPv4 address range.

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

ip_permissions[].ipv6_ranges[]
Show child fields
ip_permissions[].ipv6_ranges[].cidr_ipv6

The IPv6 address range. You can either specify a CIDR block or a source security group, not both. To specify a single IPv6 address, use the /128 prefix length.

ip_permissions[].ipv6_ranges[].description

A description for the security group rule that references this IPv6 address range.

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

ip_permissions[].prefix_list_ids[]
Show child fields
ip_permissions[].prefix_list_ids[].description

A description for the security group rule that references this prefix list ID.

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

ip_permissions[].prefix_list_ids[].prefix_list_id

The ID of the prefix.

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). If the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP codes).

ip_permissions[].user_id_group_pairs[]
Show child fields
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 ._-:/()#,@[]+=;{}!$*

ip_permissions[].user_id_group_pairs[].group_id

The ID of the security group.

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.

ip_permissions[].user_id_group_pairs[].peering_status

The status of a VPC peering connection, if applicable.

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.

ip_permissions[].user_id_group_pairs[].vpc_id

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

ip_permissions[].user_id_group_pairs[].vpc_peering_connection_id

The ID of the VPC peering connection, if applicable.

ip_permissions_egress

The outbound rules associated with the security group.

STRUCT(
"from_port" BIGINT,
"ip_protocol" VARCHAR,
"ip_ranges" STRUCT(
"cidr_ip" VARCHAR,
"description" VARCHAR
)[],
"ipv6_ranges" STRUCT(
"cidr_ipv6" VARCHAR,
"description" VARCHAR
)[],
"prefix_list_ids" STRUCT(
"description" VARCHAR,
"prefix_list_id" 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
ip_permissions_egress[]
Show child fields
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).

ip_permissions_egress[].ip_protocol

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

Use -1 to specify all protocols. When authorizing security group rules, specifying -1 or a protocol number other than tcp, udp, icmp, or icmpv6 allows traffic on all ports, regardless of any port range you specify. For tcp, udp, and icmp, you must specify a port range. For icmpv6, the port range is optional; if you omit the port range, traffic for all types and codes is allowed.

ip_permissions_egress[].ip_ranges[]
Show child fields
ip_permissions_egress[].ip_ranges[].cidr_ip

The IPv4 address range. You can either specify a CIDR block or a source security group, not both. To specify a single IPv4 address, use the /32 prefix length.

ip_permissions_egress[].ip_ranges[].description

A description for the security group rule that references this IPv4 address range.

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

ip_permissions_egress[].ipv6_ranges[]
Show child fields
ip_permissions_egress[].ipv6_ranges[].cidr_ipv6

The IPv6 address range. You can either specify a CIDR block or a source security group, not both. To specify a single IPv6 address, use the /128 prefix length.

ip_permissions_egress[].ipv6_ranges[].description

A description for the security group rule that references this IPv6 address range.

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

ip_permissions_egress[].prefix_list_ids[]
Show child fields
ip_permissions_egress[].prefix_list_ids[].description

A description for the security group rule that references this prefix list ID.

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

ip_permissions_egress[].prefix_list_ids[].prefix_list_id

The ID of the prefix.

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). If the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP codes).

ip_permissions_egress[].user_id_group_pairs[]
Show child fields
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 ._-:/()#,@[]+=;{}!$*

ip_permissions_egress[].user_id_group_pairs[].group_id

The ID of the security group.

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.

ip_permissions_egress[].user_id_group_pairs[].peering_status

The status of a VPC peering connection, if applicable.

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.

ip_permissions_egress[].user_id_group_pairs[].vpc_id

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

ip_permissions_egress[].user_id_group_pairs[].vpc_peering_connection_id

The ID of the VPC peering connection, if applicable.

owner_id

The Amazon Web Services account ID of the owner of the security group.

VARCHAR
tags

Any tags assigned to the security group.

STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
Show child fields
tags[]
Show child fields
tags[].key

The key of the tag.

Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

tags[].value

The value of the tag.

Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

vpc_id

The ID of the VPC for the security group.

VARCHAR