Feature | Description |
Configures TCCLI Provides help information Outputs results in JSON, table or text format | |
Supports multi-version API access Specifies the nearest access point (Endpoint) Filters return results Outputs the input parameters structure to JSON Reads and calls a JSON file Calls complex type dot (.) expansion |
cmd
and click OK. This document uses the LinuxOS as an example.pip install tccli
sudo pip uninstall tccli jmespathsudo pip install tccli
tccli --version
[root@VM_180_248_centos ~]# tccli --version3.0.250.1
complete -C 'tccli_completer' tccli
[root@VM_33_50_centos ~]# tccli ccam cbs cdn chdfs ckafka cloudhsm cms cr cynosdbcaptcha ccc cds cim clb cme configure cvmcat cdb cfs cis cloudaudit cmq cpdp cws[root@VM_33_50_centos ~]# tccli cvm RRebootInstances ResetInstance ResetInstancesTypeRenewHosts ResetInstancesInternetMaxBandwidth ResizeInstanceDisksRenewInstances ResetInstancesPassword RunInstances[root@VM_33_50_centos ~]# tccli cvm RunInstances ----ActionTimer --generate-cli-skeleton --InstanceType --SecurityGroupIds--ClientToken --HostName --InternetAccessible --SystemDisk--cli-input-json --HpcClusterId --LoginSettings --TagSpecification--DataDisks --ImageId --output --timeout--DisasterRecoverGroupIds --InstanceChargePrepaid --Placement --UserData--DryRun --InstanceChargeType --profile --version--endpoint --InstanceCount --region --VirtualPrivateCloud--EnhancedService --InstanceMarketOptions --secretId--filter --InstanceName --secretKey[root@VM_33_50_centos ~]# tccli cvm RunInstances --Placement
tccli configure
TencentCloud API secretId [*afcQ]:TencentCloud API secretKey [*ArFd]:region:output[json]:
tccli configure help
command.# The `set` subcommand is used to configure one or more items.tccli configure set secretId AKIDwLw1234***********nR2OTI787aBCDPtccli configure set region ap-guangzhou output json# The `get` subcommand is used to obtain configuration information.tccli configure get secretKeysecretKey = OxXj7khcV1234*********dCc1LiArFd# The `list` subcommand is used to print out all configuration information.tccli configure listcredential:secretId = AKIDwLw1234**********nR2OTI787aBCDPsecretKey = OxXj7khcV1234*********dCc1LiArFdconfigure:region = ap-guangzhououtput = json
tccli configure [list, get or set] help
command such as tccli configure list help
to view more information. # Specify the account name `test` in an interactive mode.$ tccli configure --profile testTencentCloud API secretId [*BCDP]:AKIDwLw1234***********R2OTI787aBCDPTencentCloud API secretKey [*ArFd]:OxXj7khcV1234*********dCc1LiArFdregion: ap-guangzhououtput[json]:# Specify the account name “test” for `set/get/list` subcommands. This command has the same effect as the previous one.$ tccli configure set region ap-guangzhou output json secretId AKIDwLw1234***********R2OTI787aBCDP secretKey OxXj7khcV1234*********dCc1LiArFd --profile test# Modify a parameter (such as region) alone:$ tccli configure set region ap-beijing# View the key or configurations of the `test` user.$ tccli configure get secretKey --profile test$ tccli configure list --profile test# Specify an account when calling an API such as DescribeZones API for CVM.$ tccli cvm DescribeZones --profile test
$ tccli cvm RunInstances --InstanceChargeType POSTPAID_BY_HOUR --InstanceChargePrepaid '{"Period":1,"RenewFlag":"DISABLE_NOTIFY_AND_MANUAL_RENEW"}' --Placement '{"Zone":"ap-guangzhou-2"}' --InstanceType S1.SMALL1 --ImageId img-8toqc6s3 --SystemDisk '{"DiskType":"CLOUD_BASIC", "DiskSize":50}' --InternetAccessible '{"InternetChargeType":"TRAFFIC_POSTPAID_BY_HOUR","InternetMaxBandwidthOut":10,"PublicIpAssigned":true}' --InstanceCount 1 --InstanceName TCCLI-TEST --LoginSettings '{"Password":"isd@cloud"}' --SecurityGroupIds '["sg-0rszg2vb"]' --HostName TCCLI-HOST-NAME1
[root@VM_33_50_centos ~]# tccli monitor GetMonitorData --Namespace "QCE/CVM" --Period 300 --MetricName "CPUUsage" --Instances '[{"Dimensions":[{"Name":"InstanceId","Value":"ins-cac6a4w8"}]}]'
[root@VM_33_50_centos ~]# tccli cvm RunInstances --generate-cli-skeleton > /tmp/RunInstances.json
--cli-input-json
followed by file://+file path
as shown below:[root@VM_33_50_centos ~]# tccli cvm RunInstances --cli-input-json file:///tmp/RunInstances.json{"RequestId": "20e2b42d-3260-4750-9293-79116208330e","InstanceIdSet": null}
{"a":{"b": "c"}}
will be expanded to --a.b c
. For a complex array, use .0
and .1
to represent the first and second elements of the array. For a simple array, separate multiple elements with spaces, such as --Integer 10 20
and --String str1 str2
.[root@VM_33_50_centos ~]# tccli cvm RunInstances --cli-unfold-argument --InstanceChargeType POSTPAID_BY_HOUR --InstanceChargePrepaid.Period 1 --InstanceChargePrepaid.RenewFlag DISABLE_NOTIFY_AND_MANUAL_RENEW --Placement.Zone ap-guangzhou-2 --InstanceType S1.SMALL1 --ImageId img-8toqc6s3 --SystemDisk.DiskType CLOUD_BASIC --SystemDisk.DiskSize 50 --InternetAccessible.InternetChargeType TRAFFIC_POSTPAID_BY_HOUR --InternetAccessible.InternetMaxBandwidthOut 10 --InternetAccessible.PublicIpAssigned True --InstanceCount 1 --InstanceName TCCLI-TEST --LoginSettings.Password isd@cloud --SecurityGroupIds sg-0rszg2vb --HostName TCCLI-HOST-NAME1
tccli help
command to learn all command usage.[root@VM_33_50_centos ~]# tccli helpNAMEtccliDESCRIPTIONtccli (Tencent Cloud Command Line Interface) is a tool to manage your Tencent Cloud services.CONFIGUREBefore using tccli, you should use the command(tccli configure) to configure your profile as the default For more information, please enter tccli configure helpUSEAGEtccli [options] <service> [options] <action> [options] [options and parameters]OPTIONShelpshow the tccli help info--versionshow the version of tccliAVAILABLE SERVICESafDescribes how to manage loan anti-fraud via APIs.afcDescribes how to customize modeling via APIs.ameDescribes how to operate genuine music library via APIs, including material acquisition, data reporting, etc.......
tccli cvm help
command to view supported APIs. This document uses CVM as an example.[root@VM_33_50_centos ~]# tccli cvm helpNAMEcvmAVAILABLE VERSIONS2017-03-12Only the latest version will be displayed by default. Use `help --version xxxx-xx-xx` to check other versions.DESCRIPTIONcvm-2017-03-12Describes how to manage and operate CVM instances via APIs, including image, key, and other resources.USEAGEtccli cvm <action> [--param...]OPTIONShelpshow the tccli cvm help infoAVAILABLE ACTIONSAllocateHostsCreates a CDH instanceAssociateInstancesKeyPairsBinds a key pairAssociateSecurityGroupsBinds a security group......
tccli cbs DescribeDisks help
command to view the supported API parameters. This document uses DescribeDisks API for CBS as an example.[root@VM_33_50_centos ~]# tccli cbs DescribeDisks helpNAMEDescribeDisksDESCRIPTIONcbs-2017-03-12-DescribeDisksThis API is used to query the list of cloud disks.* You can filter cloud disks by ID, type, status, etc. The relationship between different filters is logical `AND`. For more information on filters, see`Filter`.* If the parameter is empty, a number (as specified by `Limit`; the default is 20) of cloud disk will be returned.USEAGEtccli cbs DescribeDisks [--param...]OPTIONShelpshow the tccli cbs DescribeDisks help info--regionidentify the region to which the instance you want to work with belongs.--timeoutspecify a request timeout--secretKeyspecify a SecretKey......AVAILABLE PARAMS--Limit (Integer | Optional)The number of returned results. Default value: 20. Maximum value: 100. For more information on `Limit`, see the relevant sections in API [Introduction](https://www.tencentcloud.com/document/product/362/15633).--OrderField (String | Optional)Field by which the cloud disks are sorted in the response. Valid values: <br><li>CREATE_TIME: sort by creation time <br><li>DEADLINE: sort by expiration time<br>By default, the results are sorted by creation time.--Offset (Integer | Optional)The offset. Default value: 0. For more information on `Offset`, see the relevant sections in API [Introduction](https://www.tencentcloud.com/document/product/362/15633).......
[root@VM_33_50_centos ~]# tccli cvm DescribeRegions{"TotalCount": 20,"RegionSet": [{"RegionState": "AVAILABLE","Region": "ap-beijing","RegionName": "North China (Beijing)"},{"RegionState": "AVAILABLE","Region": "ap-chengdu","RegionName": "Southwest China (Chengdu)"},{"RegionState": "AVAILABLE","Region": "ap-guangzhou","RegionName": "South China (Guangzhou)"},{"RegionState": "AVAILABLE","Region": "ap-hongkong","RegionName": "Hong Kong, Macao and Taiwan, China (Hong Kong)"},{"RegionState": "AVAILABLE","Region": "ap-singapore","RegionName": "Southeast Asia (Singapore)"},{"RegionState": "AVAILABLE","Region": "ap-tokyo","RegionName": "Asia Pacific (Tokyo)"},{"RegionState": "AVAILABLE","Region": "eu-frankfurt","RegionName": "Europe (Frankfurt)"},......],"RequestId": "e5125cf1-****-****-****-316f18eed021"}
[root@VM_33_50_centos ~]# tccli cvm DescribeRegions --output table--| action |+---------------------------------------+--------------+| RequestId | TotalCount |+---------------------------------------+--------------+| 1af5f2a0-****-****-****-462f0271a69f | 20 |+---------------------------------------+--------------+|| RegionSet |||+-------------------+----------------+---------------+||| Region | RegionName | RegionState |||+-------------------+----------------+---------------+||| ap-bangkok | Asia Pacific (Bangkok) | AVAILABLE |||| ap-beijing | North China (Beijing) | AVAILABLE |||| ap-chengdu | Southwest China (Chengdu) | AVAILABLE |||| ap-chongqing | Southwest China (Chongqing) | AVAILABLE |||| ap-guangzhou | South China (Guangzhou) | AVAILABLE |||| ap-guangzhou-open| South China (Guangzhou Open) | AVAILABLE |||| ap-hongkong | Hong Kong, Macao, and Taiwan (Hong Kong, China) | AVAILABLE |||| ap-mumbai | Asia Pacific (Mumbai) | AVAILABLE |||| ap-nanjing | East China (Nanjing) | AVAILABLE |||| ap-seoul | Asia Pacific (Seoul) | AVAILABLE |||| ap-shanghai | East China (Shanghai) | AVAILABLE |||| ap-singapore | Southeast Asia (Singapore) | AVAILABLE |||| ap-tokyo | Asia Pacific (Tokyo) | AVAILABLE |||| eu-frankfurt | Europe (Frankfurt) | AVAILABLE |||| na-ashburn | Eastern US (Virginia) | AVAILABLE |||| na-siliconvalley | Western US (Silicon Valley) | AVAILABLE |||+-------------------+----------------+---------------+|
[root@VM_33_50_centos ~]# tccli cvm DescribeRegions --output text70bbd02f-****-****-****-afc5c34018ae 20REGIONSET ap-bangkok Asia Pacific (Bangkok) AVAILABLEREGIONSET ap-beijing North China (Beijing) AVAILABLEREGIONSET ap-chengdu Southwest China (Chengdu) AVAILABLEREGIONSET ap-chongqing Southwest China (Chongqing) AVAILABLEREGIONSET ap-guangzhou South China (Guangzhou) AVAILABLEREGIONSET ap-guangzhou-open South China (Guangzhou Open) AVAILABLEREGIONSET ap-hongkong Hong Kong, Macao, and Taiwan (Hong Kong, China) AVAILABLEREGIONSET ap-mumbai Asia Pacific (Mumbai) AVAILABLEREGIONSET ap-nanjing East China (Nanjing) AVAILABLEREGIONSET ap-seoul Asia Pacific (Seoul) AVAILABLEREGIONSET ap-shanghai East China (Shanghai) AVAILABLEREGIONSET ap-singapore Southeast Asia (Singapore) AVAILABLEREGIONSET ap-tokyo Asia Pacific (Tokyo) AVAILABLEREGIONSET eu-frankfurt Europe (Frankfurt) AVAILABLEREGIONSET na-ashburn Eastern US (Virginia) AVAILABLEREGIONSET na-siliconvalley Western US (Silicon Valley) AVAILABLE
tccli configure set cvm.version 2017-03-12
tccli cvm help --version 2017-03-12tccli cvm DescribeZones help --version 2017-03-12tccli cvm DescribeZones --version 2017-03-12
tccli configure set cvm.endpoint cvm.ap-guangzhou.tencentcloudapi.com
tccli cvm DescribeZones --endpoint cvm.ap-guangzhou.tencentcloudapi.com
[root@VM_180_248_centos ~]# tccli cvm DescribeZones{"TotalCount": 4,"ZoneSet": [{"ZoneState": "AVAILABLE","ZoneId": "100001","Zone": "ap-guangzhou-1","ZoneName": "Guangzhou Zone 1"},{"ZoneState": "AVAILABLE","ZoneId": "100002","Zone": "ap-guangzhou-2","ZoneName": "Guangzhou Zone 2"},{"ZoneState": "AVAILABLE","ZoneId": "100003","Zone": "ap-guangzhou-3","ZoneName": "Guangzhou Zone 3"},{"ZoneState": "AVAILABLE","ZoneId": "100004","Zone": "ap-guangzhou-4","ZoneName": "Guangzhou Zone 4"}],"RequestId": "4fd313a6-****-****-****-898c02fcae02"}
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter TotalCount4
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter ZoneSet[0]{"ZoneState": "AVAILABLE","ZoneId": "100001","Zone": "ap-guangzhou-1","ZoneName": "Guangzhou Zone 1"}
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter ZoneSet[*].ZoneName["Guangzhou Zone 1","Guangzhou Zone 2","Guangzhou Zone 3","Guangzhou Zone 4"]
[root@VM_180_248_centos ~]# tccli cvm DescribeZones --filter 'ZoneSet[*].{name:ZoneName, id:ZoneId}'[{"name": "Guangzhou Zone 1","id": "100001"},{"name": "Guangzhou Zone 2","id": "100002"},{"name": "Guangzhou Zone 3","id": "100003"},{"name": "Guangzhou Zone 4","id": "100004"}]
Was this page helpful?