Skip to main content

AWS、Azure、GCP 和阿里云的命令行实例控制

项目描述

跨企业云提供商的统一实例控制

PyPi 发布 郎

Multi-Cloud-Control 为跨 AWS、Azure、GCP 和阿里云控制云虚拟机/实例提供单一解决方案。它显示跨提供者的 VM 实例的组合列表,并允许启动、停止和建立连接。对于在多云环境中工作的 shell 用户来说,它非常有用。

该实用程序可以使用两个不同的命令执行:

  • mccl - 以“列表模式”运行,显示一个统一的实例列表及其跨提供者的状态

  • mcc - 在“命令模式”下运行,显示统一的实例列表并允许执行命令

中环

  • mccl跨提供程序显示 VM/实例及其参数的统一列表

    • 当需要快速访问信息时很有用;它显示实例列表及其状态并退出

列表模式截图

https://user-images.githubusercontent.com/1554603/33449863-4b1e182a-d5c7-11e7-958e-a1fac2ec1ee5.png

微控制器

  • mcc跨提供者显示统一的 VM 实例列表并启用命令执行

    • 专为需要控制虚拟机/实例时使用而设计

    • 列出实例和命令选项后,与提供者的经过身份验证的连接保持不变,并等待用户命令选择

    • 支持启动、停止和连接命令(通过 ssh)

    • 未来的命令可能包括:创建/删除实例、更改配置(硬件、磁盘、网络)、管理映像/快照、管理磁盘/存储、添加/删除组/集群

命令模式截图

https://user-images.githubusercontent.com/1554603/33449859-47c4677e-d5c7-11e7-8974-9212c31e785f.png

支持的 Python 版本和平台

蟒蛇 2.7、3.4、3.5、3.6、3.7

平台:

  • Linux

  • macOS (OS X)

  • Windows 10 - Linux 外壳

先决条件

在某些系统上,用于安全身份验证的库可能需要在安装过程中进行编译。为了成功编译这些依赖项,安装前必须安装以下包:

在基于 Debian / Ubuntu 的系统上安装 Pre-Reqs:

sudo apt-get install gcc python-dev libssl-dev libffi-dev -y

在基于 RedHat / CentOS 的系统上安装 Pre-Reqs:

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' 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 providers
providers = <s>alicloud,aws,azure,gcp</s>

# 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

[alicloud] 部分- 指定您的阿里云安全凭证和默认数据中心区域。 阿里云地域列表

# [alicloud] SECTION REQUIRED if alicloud is listed in providers

[alicloud]
ali_region = <s>cn-hangzhou</s>
ali_access_key_id = <s>EXCEWDYSWRP7VZOW</s>
ali_access_key_secret = <s>CHVsdhV+YgBEjJuZsJNstLGgRY43kZggNHQ</s>

[aws] 部分- 指定您的 AWS 安全凭证和默认数据中心区域。AWS 凭证信息

# [aws] SECTION REQUIRED if aws is listed in providers

[aws]
aws_access_key_id = <s>EXCEWDYSWRP7VZOW4VAW</s>
aws_secret_access_key = <s>CHVsdhV+YgBEjJuZsJNstLGgRY43kZggNHQEh/JK</s>
aws_default_region = <s>us-west-1</s>

[azure] 部分- 指定您的 Azure 租户 ID、订阅 ID、应用程序 ID 和应用程序秘密。创建 Azure 服务主体

# [azure] SECTION REQUIRED if azure is listed in providers

[azure]
az_tenant_id = <s>a3b7de99-6c36-e71f-e7d7-c5a1eefd9c01</s>
az_sub_id = <s>2ac1b147-fdca-947c-4907-3f302a667100</s>
az_app_id = <s>ee16ad1d-d266-bffa-031c-008ab40d971e</s>
az_app_sec = <s>22918C9e1cCC7665a+b3e4052f942630aE979CF68/v=</s>

[gcp] 部分- 支持两种身份验证类型。对于许多用户来说,服务帐户可能更容易,但两个选项都可用。指定身份验证类型:(S) 服务或 (A) 应用程序(如果未指定,则默认为服务)、Google Compute 项目 ID 以及身份验证类型所需的其余变量,如下所述。 有关设置服务帐户身份验证的信息

# [gcp] SECTION REQUIRED if gcp is listed in providers

[gcp]
gcp_auth_type = <s>S</s>
gcp_proj_id = <s>sampleproject-634368</s>
gcp_svc_acct_email = <s>12345678911-compute@developer.gserviceaccount.com</s>
gcp_pem_file = <s>SampleProject-72fcfdb29717.json</s>

# 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.

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

mcc-0.9.8.tar.gz (28.4 kB 查看哈希

已上传 source

内置分布

mcc-0.9.8-py2.py3-none-any.whl (21.1 kB 查看哈希

已上传 py2 py3