Skip to content
SHC Docs

Alibaba Cloud

SHC has a connection type for Alibaba Cloud. One AccessKey pair gives a cluster running on ECS instances DNS, a network load balancer and disks.

A Terraform module builds the machines and bootstraps the cluster: terraform/modules/shc/alibaba, with the example root terraform/examples/alibaba-shc and the smoke lane make test/alibaba. All three have never been applied to a real account. They stop at the machines and the bootstrap: they do not create the alibaba connection and do not record a node’s cloud and location, so do both as this page says. The module names each ECS instance after its node, which is what the disks need.

This page states what the code does. No live estate has run on Alibaba Cloud yet, so it has no list of gotchas.

ConcernValue
Connection typealibaba
Required credentialsaccess_key_id, access_key_secret, region
DNSalibaba: the account’s Alibaba Cloud DNS domains
Load balanceralibaba-nlb: one network load balancer per connection, TCP and UDP
Block volumesalibaba-disk: ESSD disks created in one zone
Node cloudalibaba, set by hand. Alibaba Cloud nodes are not detected
Node locationThe zone id, for example cn-hangzhou-h, set by hand
FieldUsed bySecretMeaning
access_key_idallyesThe AccessKey ID
access_key_secretallyesThe AccessKey secret
regionallnoThe region id, for example cn-hangzhou
zone_idvolumesnoThe zone new disks are created in, for example cn-hangzhou-h
vpc_idload balancernoAn existing VPC the load balancer is created in
zone_mappingsload balancernoA JSON array naming one existing vSwitch per zone: [{"ZoneId":"...","VSwitchId":"..."}], each zone once

The first three are required to connect. zone_id is required only for volumes: without it a volume is refused with X400325VOLCFG. vpc_id and zone_mappings are required only by the load balancer: without them a port published through the connection is refused with X400973PRXCFG.

A secret never goes on the command line. Both halves of the AccessKey are secrets, so they go in one JSON file read from standard input:

{"access_key_id": "<AccessKey ID>", "access_key_secret": "<AccessKey secret>"}
Terminal window
$ shc connection connect alibaba --cred region=cn-hangzhou --cred zone_id=cn-hangzhou-h --cred vpc_id=vpc-bp1aaaa --cred 'zone_mappings=[{"ZoneId":"cn-hangzhou-h","VSwitchId":"vsw-bp1aaaa"},{"ZoneId":"cn-hangzhou-i","VSwitchId":"vsw-bp1bbbb"}]' --value-file alibaba.json

The load balancer is named shc-<connection name>.

A block volume reaches only the nodes whose recorded cloud and location match the volume’s. For alibaba-disk that is cloud alibaba and the connection’s zone_id.

ECS instances are not detected. A node on Alibaba Cloud records no cloud and no location until you say so, and until then no alibaba-disk reaches it. A deployment whose volume cannot reach any node stays pending.

The location is the zone id as Alibaba Cloud writes it, for example cn-hangzhou-h.

Say both when the node is created:

Terminal window
$ shc init --cloud alibaba --location cn-hangzhou-h
$ shc node join <token> --cloud alibaba --location cn-hangzhou-h

Or on a node that already exists:

Terminal window
$ shc node update <node> --cloud alibaba --location cn-hangzhou-h

Check what each node records:

Terminal window
$ shc node ls

The location column reads alibaba/cn-hangzhou-h.

alibaba-disk creates one ESSD disk per volume in the connection’s zone, attaches it to the instance that runs the deployment, and moves it with the deployment.

  • A disk is at least 20 GiB. A smaller request gets 20 GiB.
  • The provider finds the instance by the node’s name: the one ECS instance whose instance name equals it. A node name that is an instance id (i-...) or a private IP address matches on that instead. Name each instance after its node. No match, or more than one, is refused.
  • The disk and the instance must be in the same zone, or the attach is refused with X400325VOLCFG.
  • An instance type that requires NVMe is refused with X400325VOLCFG. Use an instance type that attaches disks over virtio.
  • The disk is not deleted with the instance.

With more than one connection that can provision volumes, name the one to use:

Terminal window
$ shc config set storage.volumes.provider alibaba

Which mounts go on a block volume is covered in Block storage by default.

alibaba-nlb keeps one internet-facing network load balancer per connection, named shc-<connection>, billed pay-as-you-go, in the VPC and vSwitches the connection names. Every deployment that publishes a port through the connection shares it, so an outside port binds once per connection.

Publish a port through it by naming the connection after @:

Terminal window
$ shc install <app> -t <tenant> -s <stack> --expose 5432@alibaba=<service>:5432

It forwards TCP and UDP.

The alibaba DNS provider writes records in the account’s Alibaba Cloud DNS domains. Name the zones the connection manages with --zone when you connect.