Tencent Cloud is a secure, reliable and high-performance cloud compute service provided by Tencent. It is the 2nd largest Cloud Provider in China.
The Tencent Cloud driver for Salt Cloud requires the tencentcloud-sdk-python
package,
which is available at PyPI:
https://pypi.org/project/tencentcloud-sdk-python/
This package can be installed using pip
or easy_install
:
# pip install tencentcloud-sdk-python
# easy_install tencentcloud-sdk-python
/etc/salt/cloud.providers
or /etc/salt/cloud.providers.d/*.conf
:
my-tencentcloud-config:
driver: tencentcloud
# Tencent Cloud Secret Id
id: AKIDA64pOio9BMemkApzevX0HS169S4b750A
# Tencent Cloud Secret Key
key: 8r2xmPn0C5FDvRAlmcJimiTZKVRsk260
# Tencent Cloud Region
location: ap-guangzhou
Required. tencentcloud
to use this module.
Required. Your Tencent Cloud secret id.
Required. Your Tencent Cloud secret key.
Optional. If this value is not specified, the default is ap-guangzhou
.
Available locations can be found using the --list-locations
option:
# salt-cloud --list-location my-tencentcloud-config
Tencent Cloud profiles require a provider
, availability_zone
, image
and size
.
Set up an initial profile at /etc/salt/cloud.profiles
or /etc/salt/cloud.profiles.d/*.conf
:
tencentcloud-guangzhou-s1sm1:
provider: my-tencentcloud-config
availability_zone: ap-guangzhou-3
image: img-31tjrtph
size: S1.SMALL1
allocate_public_ip: True
internet_max_bandwidth_out: 1
password: '153e41ec96140152'
securitygroups:
- sg-5e90804b
Required. Name of entry in salt/cloud.providers.d/???
file.
Required. The availability zone that the instance is located in.
Available zones can be found using the list_availability_zones
function:
# salt-cloud -f list_availability_zones my-tencentcloud-config
Required. The image id to use for the instance.
Available images can be found using the --list-images
option:
# salt-cloud --list-images my-tencentcloud-config
Required. Instance type for instance can be found using the --list-sizes
option.
# salt-cloud --list-sizes my-tencentcloud-config
Optional. A list of security group ids to associate with.
Available security group ids can be found using the list_securitygroups
function:
# salt-cloud -f list_securitygroups my-tencentcloud-config
Multiple security groups are supported:
tencentcloud-guangzhou-s1sm1:
securitygroups:
- sg-5e90804b
- sg-8kpynf2t
Optional. The hostname of the instance.
Optional. The charge type of the instance. Valid values are PREPAID
,
POSTPAID_BY_HOUR
and SPOTPAID
. The default is POSTPAID_BY_HOUR
.
Optional. When enabled, the instance will be renew automatically
when it reaches the end of the prepaid tenancy.
Valid values are NOTIFY_AND_AUTO_RENEW
, NOTIFY_AND_MANUAL_RENEW
and DISABLE_NOTIFY_AND_MANUAL_RENEW
.
Note
This value is only used when instance_charge_type
is set to PREPAID
.
Optional. The tenancy time in months of the prepaid instance,
Valid values are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36
.
Note
This value is only used when instance_charge_type
is set to PREPAID
.
Optional. Associate a public ip address with an instance
in a VPC or Classic. Boolean value, default is false
.
Optional. Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bits per second).
Value range: [0, 100]
. If this value is not specified, the default is 0
Mbps.
Optional. Internet charge type of the instance. Valid values are BANDWIDTH_PREPAID
,
TRAFFIC_POSTPAID_BY_HOUR
, BANDWIDTH_POSTPAID_BY_HOUR
and BANDWIDTH_PACKAGE
.
The default is TRAFFIC_POSTPAID_BY_HOUR
.
Optional. The key pair to use for the instance, for example skey-16jig7tx
.
Optional. Login password for the instance.
Optional. The private ip to be assigned to this instance, must be in the provided subnet and available.
Optional. The project this instance belongs to, defaults to 0
.
Optional. The id of a VPC network. If you want to create instances in a VPC network, this parameter must be set.
Optional. The id of a VPC subnet. If you want to create instances in VPC network, this parameter must be set.
Optional. Size of the system disk.
Value range: [50, 1000]
, and unit is GB
. Default is 50
GB.
Optional. Type of the system disk.
Valid values are CLOUD_BASIC
, CLOUD_SSD
and CLOUD_PREMIUM
, default value is CLOUD_BASIC
.
The following actions are supported by the Tencent Cloud Salt Cloud driver.
This action is a thin wrapper around --full-query
, which displays details on a
single instance only. In an environment with several machines, this will save a
user from having to sort through all instance data, just to examine a single
instance.
$ salt-cloud -a show_instance myinstance
Return disk details about a specific instance.
$ salt-cloud -a show_disk myinstance
Destroy a Tencent Cloud instance.
$ salt-cloud -a destroy myinstance
Start a Tencent Cloud instance.
$ salt-cloud -a start myinstance
Stop a Tencent Cloud instance.
$ salt-cloud -a stop myinstance
Reboot a Tencent Cloud instance.
$ salt-cloud -a reboot myinstance
The following functions are currently supported by the Tencent Cloud Salt Cloud driver.
Lists all Tencent Cloud security groups in current region.
$ salt-cloud -f list_securitygroups my-tencentcloud-config
Lists all Tencent Cloud availability zones in current region.
$ salt-cloud -f list_availability_zones my-tencentcloud-config
Lists any custom images associated with the account. These images can be used to create a new instance.
$ salt-cloud -f list_custom_images my-tencentcloud-config
Return details about a specific image. This image can be used to create a new instance.
$ salt-cloud -f show_image tencentcloud image=img-31tjrtph