百度智能云

All Product Document

          Virtual Private Cloud

          Subnet Related Operations

          Create Subnet

          Description

          Create a subnet in VPC.

          Command format

          $ bce vpc create-subnet <vpc_id> <subnet_name> <zone_name> <cidr> [-st SUBNET_TYPE] [-des DESCRIPTION]

          Note:

          • Subnet_name: the subnet name cannot take the "default" value, with the length not exceeding 65 characters, and can be composed by numbers, characters and underlines.
          • zone_name: Available zone name.
          • cidr: Subnet cidr.
          • Vpc_id: id of vpc to which the subnet belongs.
          • -des DESCRIPTION, --description DESCRIPTION: subnet description, not exceeding 200 characters.
          • -st SUBNET_TYPE, --subnet_type SUBNET_TYPE: subnet type, "BCC" and "BBC".

          Example for Operation

          $ bce vpc create-subnet vpc-2mdntsz0jbki test-name cn-bj-a 192.168.0.0/24

          Example for Return

          {
              "subnet_id": "sbn-fxgs4vq0g3np"
          }
          Parameter name Type Description
          subnet_id String Create id of subnet.

          Query Subnet List

          Description

          Query all the subnet list information.

          Command Format

          $ bce vpc list-subnet [-a] [-vi VPC_ID] [-mkr MARKER] [-mky MAX_KEYS] [-zn ZONE_NAME] [-st {BCC,BBC}]

          Note:

          • -a, --all list all subnets.
          • -vi VPC_ID, --vpc_id VPC_ID : id of vpc to which the subnet belongs.
          • -mkr MARKER, --marker MARKER: The starting location of query for batch acquisition of lists, and is one string generated by the system.
          • -mky MAX_KEYS, --max_keys MAX_KEYS: Maximum VPC number contained in each page, generally not exceeding 1000. The default value is 1000.
          • -zn ZONE_NAME, --zone_name ZONE_NAME: Name of the available zone affiliated.
          • -st {BCC,BBC}, --subnet_type {BCC,BBC}: Subnet type, "BCC" and "BBC".

          Example for Operation

          $ bce vpc list-subnet

          Example for return

          {
              "marker": null,
              "max_keys": 1000,
              "subnets": [
                  {
                      "subnet_type": "BCC",
                      "name": "system predefined subnet", 
                      "vpc_id": "vpc-suzek0b5vi4r",
                      "subnet_id": "sbn-yf43kw8wj3ss",
                      "zone_name": "cn-bj-a",
                      "cidr": "192.168.0.0/20",
                      "description": ""
                  },
                  {
                      "subnet_type": "BCC",
                      "name": "test-name",
                      "vpc_id": "vpc-2mdntsz0jbki",
                      "subnet_id": "sbn-fxgs4vq0g3np",
                      "zone_name": "cn-bj-a",
                      "cidr": "192.168.0.0/24",
                      "description": ""
                  }
              ],
              "is_truncated": false
          }
          Parameter name Type Description
          marker String It marks the queried starting position.
          is_truncated boolean True means there are additional data in the following pages and false means the current page is the last page.
          nextMarker String The marker value requiring to be passed in order to acquire the next page. The domain doesn't appear when isTruncated is false.
          max_keys Integer Maximum number contained in each page.
          subnets List\<Subnet> Instance information, an set composed by Subnets.

          Query a Specified Subnet

          Description

          Query the detailed information of the specified subnet.

          Command Format

          $ bce vpc show-subnet <subnet_id>

          Example for Operation

          $ bce vpc show-subnet sbn-fxgs4vq0g3np

          Example for Return

          {
              "subnet": {
                  "subnet_type": "BCC",
                  "name": "test-name",
                  "vpc_id": "vpc-2mdntsz0jbki",
                  "subnet_id": "sbn-fxgs4vq0g3np",
                  "zone_name": "cn-bj-a",
                  "cidr": "192.168.0.0/24",
                  "description": ""
              }
          }
          Parameter name Type Description
          subnet Subnet Returned instance details

          Delete Subnet

          Description

          Delete a subnet.

          Command Format

          $ bce vpc delete-subnet <subnet_id>

          Example for Operation

          $ bce vpc delete-subnet sbn-fxgs4vq0g3np

          Example for Return

          {}

          There is no special return parameter.

          Update the Subnet

          Description

          Update the subnet information.

          Command Format

          $ bce vpc update-subnet <subnet_id> <name>[-des DESCRIPTION]

          Note:

          • Subnet_id: instance ID of subnet to be updated.
          • -des, --description VPC description, not exceeding 200 characters.
          • Name: the subnet name cannot take the "default" value, with the length not exceeding 65 characters, and can be composed by numbers, characters and underlines.

          Example for Operation

          $ bce vpc update-subnet sbn-fxgs4vq0g3np update-name -des update-description 

          Example for Return

          {}

          There is no special return parameter.

          Previous
          VPC Related Operations
          Next
          Route Table Related Operations