aws、azure、gcp和阿里云的命令行实例控制
mcc的Python项目详细描述
跨企业云提供商的统一实例控制
多云控制为跨aws、azure、gcp和阿里云控制云vm/实例提供了单一解决方案。它显示跨提供程序的vm实例的组合列表,并允许启动、停止和建立连接。它对于在多云环境中工作的shell用户非常有用。
此实用程序可以使用两个不同的命令执行:
- mccl-在“列表模式”下运行,该模式在提供程序之间显示实例及其状态的统一列表
- mcc-以“命令模式”运行,该模式显示统一的实例列表,并允许执行命令
mccl
- mccl在提供者之间显示vm/实例及其参数的统一列表
- 在需要快速访问信息时有用;它显示实例的列表以及它们的状态和退出< /LI>
列表模式屏幕截图
mcc
- mcc显示跨提供程序的vm实例的统一列表,并启用命令执行
- 设计用于需要控制虚拟机/实例时
- 列出实例和命令选项后,将保持到提供程序的已验证连接,并等待用户命令选择
- 支持启动、停止和连接命令(通过ssh)
- 未来的命令可能包括:创建/删除实例、更改配置(硬件、磁盘、网络)、管理映像/快照、管理磁盘/存储、向组/群集添加/删除
命令模式屏幕截图
支持的Python版本和平台
Python2.7、3.4、3.5、3.6、3.7
平台:
- Linux
- MacOS(OS X)
- Windows 10-Linux外壳
前置需求
在某些系统的安装过程中,用于安全身份验证的库可能需要编译。为了成功编译这些依赖项,必须在安装之前安装以下软件包:
在基于debian/ubuntu的系统上安装前置请求:
sudo apt-get install gcc python-dev libssl-dev libffi-dev -y
在基于redhat/centos的系统上安装前置请求:
sudo yum install gcc python-devel openssl-devel libffi-devel -y
安装
此实用程序可以与pip一起安装:
pip install --user mcc
配置
可以在mcc wiki上找到新的配置说明
第一次执行实用程序时,它将执行以下设置任务:
- 创建其配置目录{home}/.cloud
- 将示例config.ini文件复制到新的配置目录
- 指示用户将其凭据信息添加到config.ini
- 示例config.ini包含示例配置数据,以及描述如何添加实际数据的大量注释。
编辑config.ini文件时的注意事项:
- 不要更改键的名称(符号“=”左边的标题)
- 可以删除带有注释的行(以开头的行)
config.ini-info部分和提供程序列表
# 'INFO' SECTION AND 'PROVIDERS' LIST# - There must be a section named [info] and it must contain the entry providers## - providers is a list of the cloud providers the utility should connect to# - ONLY include providers you have credentials for AND want to use# - you must use the exact values listed to reference the providers:# - "alicloud", "aws", "azure", and "gcp"# - multiple account per provider is supported, see section at bottom for details[info]# this example - connects to all three providersproviders=alicloud,aws,azure,gcp# CREDENTIALS DATA SECTIONS# - one section with matching name for each item listed in providers# - each section contains the credentials for that provider# ex: [aws] - specifies aws credentials
[阿里云]部分-指定您的阿里云安全凭据和默认数据中心区域。Alibaba Cloud region list
# [alicloud] SECTION REQUIRED if alicloud is listed in providers[alicloud]ali_region=cn-hangzhouali_access_key_id=EXCEWDYSWRP7VZOWali_access_key_secret=CHVsdhV+YgBEjJuZsJNstLGgRY43kZggNHQ
[aws]部分-指定aws安全凭据和默认数据中心区域。Information on AWS Credentials
# [aws] SECTION REQUIRED if aws is listed in providers[aws]aws_access_key_id=EXCEWDYSWRP7VZOW4VAWaws_secret_access_key=CHVsdhV+YgBEjJuZsJNstLGgRY43kZggNHQEh/JKaws_default_region=us-west-1
[azure]部分-指定你的azure租户id、订阅id、应用程序id和应用程序机密。Creating an Azure Service Principal
# [azure] SECTION REQUIRED if azure is listed in providers[azure]az_tenant_id=a3b7de99-6c36-e71f-e7d7-c5a1eefd9c01az_sub_id=2ac1b147-fdca-947c-4907-3f302a667100az_app_id=ee16ad1d-d266-bffa-031c-008ab40d971eaz_app_sec=22918C9e1cCC7665a+b3e4052f942630aE979CF68/v=
[gcp]节-支持两种身份验证类型。服务帐户对我们来说可能更容易呃,但两个选项都有。指定身份验证类型:(s)s ervice或(a)a pplication(如果未指定,则默认为service)、google compute project id以及身份验证类型所需的其余变量,如下所述。Information on Setting up Service Account Authentication
# [gcp] SECTION REQUIRED if gcp is listed in providers[gcp]gcp_auth_type=Sgcp_proj_id=sampleproject-634368gcp_svc_acct_email=12345678911-compute@developer.gserviceaccount.comgcp_pem_file=SampleProject-72fcfdb29717.json# gcp SUPPORTS TWO AUTHENTICATION TYPES:## gcp_auth_type - specifies which type to use ( S or A )# - if omitted, it defaults to Service Account Auth## S = Service Account Auth (default)# - requires that the service account key (json file) copied or moved to config dir# (the example above lists the values needed for Service Account Auth)## A = Installed Application Auth - when using this auth type:# - the first time the program is run with the proper credentials listed# - it displays a URL in the terminal session# - this URL must be pasted into a web-browser to display a code# - copy the code from the web browser and paste it into the terminal# - then program will then continue running## The example below lists the values needed for Installed Application Auth## [gcp]# gcp_auth_type = A# gcp_proj_id = sampleproject-634368# gcp_client_id = 12345678911-LZXcWZmyzU3v3qNPPJNEimoKgh9Wruo4.apps.googleusercontent.com# gcp_client_sec = t4ugvWTocssrVtX448tDEWBW
指定多个帐户-一个或多个提供程序
# Step 1# - add an additional entry to the 'providers' list - in this exact format:# - the entry begins with the standard values: aws, azure, gcp# - it is immediately followed by a numeric suffix# ex: aws2 (for a 2nd set of aws credentials)# - no additional characters are allowed or it will not be recognized and fail## Step 2# - add a section below of the same name containing the corresponding credentials# - ex: [aws2] (containing the 2nd set of aws credentials, for the earlier example)# - this new credentials section must include all credentials for the 2nd account,# even if some are the same as the primary account.