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, regionfrom alicloud_vpcwhere is_default;
select name, vpc_id, is_default, cidr_block, status, account_id, regionfrom alicloud_vpcwhere 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, regionfrom alicloud_vpcwhere 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_idfrom alicloud_vpc as vpc join alicloud_vpc_vswitch as vswitch on vpc.vpc_id = vswitch.vpc_idorder by vpc.vpc_id;
select vpc.vpc_id, vswitch.vswitch_id, vswitch.cidr_block, vswitch.status, vswitch.available_ip_address_count, vswitch.zone_idfrom alicloud_vpc as vpc join alicloud_vpc_vswitch as vswitch on vpc.vpc_id = vswitch.vpc_idorder by vpc.vpc_id;
Query examples
Schema for alicloud_vpc
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Alicloud Account ID in which the resource is located. |
advanced_resource | boolean | ||
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
arn | text | The Alibaba Cloud Resource Name (ARN) of the VPC. | |
associated_cens | jsonb | The 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_status | text | Indicates whether the VPC is attached to any Cloud Enterprise Network (CEN) instance. | |
cidr_block | cidr | The IPv4 CIDR block of the VPC. | |
classic_link_enabled | boolean | True if the ClassicLink function is enabled. | |
cloud_resources | jsonb | The list of resources in the VPC. | |
creation_time | timestamp with time zone | The creation time of the VPC. | |
description | text | The description of the VPC. | |
dhcp_options_set_id | text | The ID of the DHCP options set associated to vpc. | |
dhcp_options_set_status | text | The status of the VPC network that is associated with the DHCP options set. Valid values: InUse and Pending | |
ipv6_cidr_block | cidr | The IPv6 CIDR block of the VPC. | |
ipv6_cidr_blocks | jsonb | The IPv6 CIDR blocks of the VPC. | |
is_default | boolean | !=, = | True if the VPC is the default VPC in the region. |
name | text | = | The name of the VPC. |
nat_gateway_ids | jsonb | A list of IDs of NAT Gateways. | |
network_acl_num | text | ||
owner_id | text | The ID of the owner of the VPC. | |
region | text | The Alicloud region in which the resource is located. | |
resource_group_id | text | The ID of the resource group to which the VPC belongs. | |
route_table_ids | jsonb | A list of IDs of route tables. | |
secondary_cidr_blocks | jsonb | A list of secondary IPv4 CIDR blocks of the VPC. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status | text | The status of the VPC. Pending: The VPC is being configured. Available: The VPC is available. | |
support_advanced_feature | boolean | ||
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | A map of tags for the resource. | |
title | text | Title of the resource. | |
user_cidrs | jsonb | A list of user CIDRs. | |
vpc_id | text | = | The unique ID of the VPC. |
vrouter_id | text | The ID of the VRouter. | |
vswitch_ids | jsonb | A 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