K2 Cloud API Client
In this article:
K2 Cloud API Client#
Important
Для работы с K2 Cloud API Client требуется Python 3 ≥ 3.6
To work with various K2 Cloud API, you can use utilities from the c2-client package.
The package includes the following utilities:
c2-as
— a client for Auto Scaling API;c2-ct
— command-line client for CloudTrail API;c2-cw
— command-line client for CloudWatch API;c2-dc
— command-line client for DirectConnect API;c2-ec2
— command-line client for EC2 API;c2-eks
— command-line client for the EKS API;c2-elb
— command-line client for the Elastic Load Balancing API;c2-iam
— client to IAM API;c2-paas
— command-line client for PaaS API;c2-route53
— command-line client for Route53 API;c2rc-convert
— utility for converting settings to be used in Windows.
To manage resources in K2 Cloud via API, you should use the customized version of the libraries python-botocore and python-boto3.
Installation#
All operation systems#
pip install git+https://github.com/C2Devel/boto3.git
pip install git+https://github.com/C2Devel/botocore.git
pip install c2client
Use#
Get API access settings in the K2 Cloud management console. Click the user login in the top right corner, select Profile Get API access settings.
In the C2_PROJECT variable, specify your project ID.
Add the settings you have got to environment variables:
For Windows, convert the settings file and export environment variables:
C:\> c2rc-convert path\to\c2rc.sh path\to\c2rc.bat
C:\> call path\to\c2rc.bat
For Linux, export environment variables:
source path/to/c2rc.sh
Now you can use the utilities according to documentation. For example:
c2-ec2 DescribeAvailabilityZones
c2-eks DescribeCluster name backend_production