turbot/alicloud
steampipe plugin install alicloud

Table: alicloud_vpc_vswitch - Query Alibaba Cloud VPC VSwitches using SQL

A VSwitch is a basic network device of a VPC in Alibaba Cloud, which connects different cloud product instances. It is similar to a traditional switch in a data center, which provides a communication channel for cloud product instances in the same network segment. VSwitches are used to create an isolated network environment, which can be associated with different cloud resources.

Table Usage Guide

The alicloud_vpc_vswitch table provides insights into VSwitches within Alibaba Cloud Virtual Private Cloud (VPC). As a network administrator, explore VSwitch-specific details through this table, including its ID, status, creation time, and associated metadata. Utilize it to uncover information about VSwitches, such as their availability zones, CIDR blocks, and the VPCs they belong to.

Examples

Basic info

Explore the status and default settings of various zones within your virtual private cloud (VPC) to assess their configuration and better manage your resources.

select
name,
vswitch_id,
status,
cidr_block,
zone_id,
is_default
from
alicloud_vpc_vswitch;
select
name,
vswitch_id,
status,
cidr_block,
zone_id,
is_default
from
alicloud_vpc_vswitch;

Get the number of available IP addresses in each VSwitch

Explore the capacity of each VSwitch by determining the number of available IP addresses. This can aid in resource allocation and network planning.

select
name,
vswitch_id,
available_ip_address_count,
power(2, 32 - masklen(cidr_block :: cidr)) -1 as raw_size
from
alicloud_vpc_vswitch;
Error: SQLite does not support CIDR operations.

Route Table info associated with VSwitch

Explore the relationship between your VSwitch and its associated route tables in your Alicloud VPC setup. This allows you to gain insights into your network's routing configurations and better manage your network traffic flow.

select
name,
vswitch_id,
route_table ->> 'RouteTableId' as route_table_id,
route_table ->> 'RouteTableType' as route_table_type,
route_table -> 'RouteEntrys' -> 'RouteEntry' as route_entry
from
alicloud_vpc_vswitch;
select
name,
vswitch_id,
json_extract(route_table, '$.RouteTableId') as route_table_id,
json_extract(route_table, '$.RouteTableType') as route_table_type,
json_extract(route_table, '$.RouteEntrys.RouteEntry') as route_entry
from
alicloud_vpc_vswitch;

VSwitch count by VPC ID

Determine the number of virtual switches within each Virtual Private Cloud to effectively manage network resources and ensure optimal distribution.

select
vpc_id,
count(vswitch_id) as vswitch_count
from
alicloud_vpc_vswitch
group by
vpc_id;
select
vpc_id,
count(vswitch_id) as vswitch_count
from
alicloud_vpc_vswitch
group by
vpc_id;

Schema for alicloud_vpc_vswitch

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The Alicloud Account ID in which the resource is located.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
available_ip_address_countbigintThe number of available IP addresses in the VSwitch.
cidr_blockcidrThe IPv4 CIDR block of the VPC.
cloud_resourcesjsonbThe list of resources in the VSwitch.
creation_timetimestamp with time zoneThe creation time of the VPC.
descriptiontextThe description of the VPC.
ipv6_cidr_blockcidrThe IPv6 CIDR block of the VPC.
is_defaultbooleanTrue if the VPC is the default VPC in the region.
nametextThe name of the VPC.
network_acl_idtextA list of IDs of NAT Gateways.
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_tablejsonbDetails of the route table.
share_typetext
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
statustextThe status of the VPC. Pending: The VPC is being configured. Available: The VPC is available.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA map of tags for the resource.
titletextTitle of the resource.
vpc_idtextThe ID of the VPC to which the VSwitch belongs.
vswitch_idtextThe unique ID of the VPC.
zone_idtextThe zone to which the VSwitch belongs.

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_vswitch