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_defaultfrom alicloud_vpc_vswitch;
select name, vswitch_id, status, cidr_block, zone_id, is_defaultfrom 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_sizefrom 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_entryfrom 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_entryfrom 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_countfrom alicloud_vpc_vswitchgroup by vpc_id;
select vpc_id, count(vswitch_id) as vswitch_countfrom alicloud_vpc_vswitchgroup by vpc_id;
Query examples
Schema for alicloud_vpc_vswitch
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Alicloud Account ID in which the resource is located. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
available_ip_address_count | bigint | The number of available IP addresses in the VSwitch. | |
cidr_block | cidr | The IPv4 CIDR block of the VPC. | |
cloud_resources | jsonb | The list of resources in the VSwitch. | |
creation_time | timestamp with time zone | The creation time of the VPC. | |
description | text | The description of the VPC. | |
ipv6_cidr_block | cidr | The IPv6 CIDR block of the VPC. | |
is_default | boolean | True if the VPC is the default VPC in the region. | |
name | text | The name of the VPC. | |
network_acl_id | text | A list of IDs of NAT Gateways. | |
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 | jsonb | Details of the route table. | |
share_type | text | ||
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. | |
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. | |
vpc_id | text | The ID of the VPC to which the VSwitch belongs. | |
vswitch_id | text | The unique ID of the VPC. | |
zone_id | text | The 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