Repository navigation
IDs for Create Server
compute.CreateServer and compute.QuoteCreateServer take IDs that each
come from a read call. This page names the call that finds each one. The
examples assume cfg and ctx from Compute's Setup.
CreateServerInput field |
SDK call | ID field on each row |
|---|---|---|
ZoneID |
portal.ListZones |
UUID (check for nil) |
FlavorID |
compute.ListFlavors with ZoneID
|
FlavorID |
ImageID |
compute.ListOSImages with ZoneID
|
ID |
RootDiskTypeID, DataDiskTypeID
|
volume.ListVolumeTypes with ZoneID
|
ID |
VPCID |
network.ListVPCs |
UUID |
SubnetID |
network.ListSubnetsByVPC |
UUID |
SecurityGroupIDs |
network.ListSecurityGroups |
ID |
SSHKeyID |
compute.ListSSHKeys |
ID |
ServerGroupID (optional) |
compute.ListServerGroups |
UUID |
A quote needs only the zone, flavor, image, and root disk type. The other
IDs matter when you create the server. The CLI section lists the
matching vngcloud commands.
Pick a zone first; the other three lookups take it.
zones, err := portal.New(cfg).ListZones(ctx, nil)
if err != nil {
log.Fatal(err)
}Zone rows are typed structs. Check zone.UUID != nil before reading
*zone.UUID; an absent or null UUID stays nil. The separate ID field
supports the synthetic fixture's shape and provides no fallback for UUID.
IsEnabled is also a pointer; a present false value is a hint, not a gate.
flavors, err := compute.New(cfg).ListFlavors(ctx, &compute.ListFlavorsInput{
ZoneID: "<zone-id>",
Name: "s2-general-1x2",
})
images, err := compute.New(cfg).ListOSImages(ctx, &compute.ListOSImagesInput{
ZoneID: "<zone-id>",
})
types, err := volume.New(cfg).ListVolumeTypes(ctx, &volume.ListVolumeTypesInput{
ZoneID: "<zone-id>",
})ListFlavors with ZoneID covers every flavor zone in the zone and fills
each row's FlavorZoneID. Sold-out flavors stay in the list; skip rows with
IsSoldOut true. Without Name, the list holds every flavor. See
Listing flavors and Listing volume
types for the fan-out rules.
vpcs, err := network.New(cfg).ListVPCs(ctx, nil)
subnets, err := network.New(cfg).ListSubnetsByVPC(ctx, &network.ListSubnetsByVPCInput{
VPCID: "<vpc-id>",
})
groups, err := network.New(cfg).ListSecurityGroups(ctx, nil)
keys, err := compute.New(cfg).ListSSHKeys(ctx, nil)
serverGroups, err := compute.New(cfg).ListServerGroups(ctx, nil)Then quote and create as shown on Compute Servers.
Each command prints {"Items": [...]}, so a --query starts with Items.
Rows print Go field names. Zone pointer fields print null in JSON when
absent or null; unknown fields are ignored.
create-server flag |
Command |
|---|---|
--zone-id |
portal list-zones |
| (flavor zones) | compute list-flavor-zones --zone-id <zone> |
--flavor-id |
compute list-flavors --zone-id <zone> --name <flavor> |
--image-id |
compute list-os-images --zone-id <zone> |
--root-disk-type-id, --data-disk-type-id
|
volume list-volume-types --zone-id <zone> --iops 3000 |
--vpc-id |
network list-vpcs |
--subnet-id |
network list-subnets-by-vpc --vpc-id <vpc> |
--security-group-id |
network list-security-groups |
--ssh-key-id |
compute list-ssh-keys |
--server-group-id (optional) |
compute list-server-groups |
Pick the ID with one --query per lookup:
vngcloud portal list-zones --query "Items[].[UUID,Name]"
vngcloud compute list-flavors --zone-id <zone> --name s2-general-1x2 \
--query "Items[?!IsSoldOut].[FlavorID,FlavorZoneID]"
vngcloud compute list-os-images --zone-id <zone> \
--query "Items[].[ID,ImageType,ImageVersion]"
vngcloud volume list-volume-types --zone-id <zone> --iops 3000 \
--query "Items[].[ID,Name,MinSize,MaxSize]"
vngcloud network list-vpcs --query "Items[].[UUID,Name]"
vngcloud network list-subnets-by-vpc --vpc-id <vpc> \
--query "Items[].[UUID,Name]"
vngcloud network list-security-groups --query "Items[].[ID,Name]"
vngcloud compute list-ssh-keys --query "Items[].[ID,Name]"
vngcloud compute list-server-groups --query "Items[].[UUID,Name]"--zone-id on list-flavors and list-volume-types makes one request for
the zone's flavor zones or volume type zones, then one per flavor zone or
volume type zone. --name and --iops match exactly. A row's ZoneID is
the API's own zone identifier, not the network zone name; tell rows apart by
FlavorZoneID (flavors) or VolumeTypeZoneID (volume types). See
CLI: Compute and
CLI: Volume.
SDK
- Getting Started
- Authentication
- Configuration
- Errors
- Services
- Backup
- Billing and Pricing
- CDN
- Compute
- Compute Servers
- DNS
- Container Registry
- IAM
- Load Balancer
- Monitor
- Monitor Alerts
- Monitor Log Alarms
- Network
- Network Route Tables
- Network ACLs
- Network DHCP Options
- Network Virtual IPs
- Tagging
- Storage
- Storage Workload Access
- Storage Objects
- Storage Object Copy
- Storage: Projects
- Storage: Bucket Policy
- Storage: Bucket Settings
- Security
- Volume
- VKS
- Limitations
CLI