turbot/alicloud
steampipe plugin install alicloud

Table: alicloud_vpc - Query Alibaba Cloud Virtual Private Clouds using SQL

Alibaba Cloud Virtual Private Cloud (VPC) is a private, isolated network environment based on Alibaba Cloud. It allows users to launch Alibaba Cloud resources in a virtual network that they define. With VPC, users can customize their network configuration, such as IP address range, subnet creation, route table, and network gateway.

Table Usage Guide

The alicloud_vpc table provides insights into Virtual Private Clouds within Alibaba Cloud. As a network administrator, explore VPC-specific details through this table, including VPC ID, creation time, status, and other details. Utilize it to uncover information about your network configurations, such as IP address range, subnet creation, route table, and network gateway.

Examples

Find default VPCs

Determine the areas in which default VPCs are being used across different accounts and regions. This can be useful for managing network accessibility and understanding the distribution of resources in a cloud environment.

select
name,
vpc_id,
is_default,
cidr_block,
status,
account_id,
region
from
alicloud_vpc
where
is_default;
select
name,
vpc_id,
is_default,
cidr_block,
status,
account_id,
region
from
alicloud_vpc
where
is_default;

Show CIDR details

Determine the characteristics of your network such as host address, broadcast address, netmask, and network address to better understand and manage your network infrastructure.

select
vpc_id,
cidr_block,
host(cidr_block),
broadcast(cidr_block),
netmask(cidr_block),
network(cidr_block)
from
alicloud_vpc;
Error: SQLite does not support CIDR operations.

List VPCs with public CIDR blocks

Identify instances where your VPCs have CIDR blocks that are publicly accessible. This is useful for assessing potential security risks and ensuring that your network configurations align with best practices.

select
vpc_id,
cidr_block,
status,
region
from
alicloud_vpc
where
not cidr_block << = '10.0.0.0/8'
and not cidr_block << = '192.168.0.0/16'
and not cidr_block << = '172.16.0.0/12';
Error: SQLite does not support CIDR operations.

Get the VSwitches details for VPCs

Explore the status and available IP addresses of virtual switches within specific virtual private clouds. This is useful for managing and optimizing network resources in a cloud environment.

select
vpc.vpc_id,
vswitch.vswitch_id,
vswitch.cidr_block,
vswitch.status,
vswitch.available_ip_address_count,
vswitch.zone_id
from
alicloud_vpc as vpc
join alicloud_vpc_vswitch as vswitch on vpc.vpc_id = vswitch.vpc_id
order by
vpc.vpc_id;
select
vpc.vpc_id,
vswitch.vswitch_id,
vswitch.cidr_block,
vswitch.status,
vswitch.available_ip_address_count,
vswitch.zone_id
from
alicloud_vpc as vpc
join alicloud_vpc_vswitch as vswitch on vpc.vpc_id = vswitch.vpc_id
order by
vpc.vpc_id;

Schema for alicloud_vpc

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextThe Alicloud Account ID in which the resource is located.
advanced_resourceboolean
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
arntextThe Alibaba Cloud Resource Name (ARN) of the VPC.
associated_censjsonbThe list of Cloud Enterprise Network (CEN) instances to which the VPC is attached. No value is returned if the VPC is not attached to any CEN instance.
cen_statustextIndicates whether the VPC is attached to any Cloud Enterprise Network (CEN) instance.
cidr_blockcidrThe IPv4 CIDR block of the VPC.
classic_link_enabledbooleanTrue if the ClassicLink function is enabled.
cloud_resourcesjsonbThe list of resources in the VPC.
creation_timetimestamp with time zoneThe creation time of the VPC.
descriptiontextThe description of the VPC.
dhcp_options_set_idtextThe ID of the DHCP options set associated to vpc.
dhcp_options_set_statustextThe status of the VPC network that is associated with the DHCP options set. Valid values: InUse and Pending
ipv6_cidr_blockcidrThe IPv6 CIDR block of the VPC.
ipv6_cidr_blocksjsonbThe IPv6 CIDR blocks of the VPC.
is_defaultboolean!=, =True if the VPC is the default VPC in the region.
nametext=The name of the VPC.
nat_gateway_idsjsonbA list of IDs of NAT Gateways.
network_acl_numtext
owner_idtextThe ID of the owner of the VPC.
regiontextThe Alicloud region in which the resource is located.
resource_group_idtextThe ID of the resource group to which the VPC belongs.
route_table_idsjsonbA list of IDs of route tables.
secondary_cidr_blocksjsonbA list of secondary IPv4 CIDR blocks of the VPC.
statustextThe status of the VPC. Pending: The VPC is being configured. Available: The VPC is available.
support_advanced_featureboolean
tagsjsonbA map of tags for the resource.
tags_srcjsonbA map of tags for the resource.
titletextTitle of the resource.
user_cidrsjsonbA list of user CIDRs.
vpc_idtext=The unique ID of the VPC.
vrouter_idtextThe ID of the VRouter.
vswitch_idsjsonbA list of VSwitches in the VPC.

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)" -- alicloud

You can pass the configuration to the command with the --config argument:

steampipe_export_alicloud --config '<your_config>' alicloud_vpc