Centrica Chaim AWS账户
chaim-cli的Python项目详细描述
Centrica Chaim AWS帐户cli
这是命令行实用程序cca
的代码。
cca是使用click参数解析重新想象chaim cli python模块。
Install
chaim cli是一个python 3应用程序。建议安装到 使用pip的本地、用户、python包。如果这是您的第一个本地python 包,然后你需要调整你的路径,以便外壳可以找到它。
echo 'export PATH=${HOME}/.local/bin:${PATH}' >>${HOME}/.bashrc
Linux
这些指令是为ubuntu及其衍生物编写的。对于其他 分布过程是相似的,尽管可能有不同的包 名字。您需要安装python3版本和pip程序 那是Python3号意识到的。
安装python3
对于Ubuntu18.04之前的版本,您需要安装python3及其相关的pip 申请。最简单的方法是:
sudo apt install python3-pip
它会把所有需要的东西都拉进来。
安装CCA
要安装chaim cli:
pip3 install chaim-cli --upgrade --user --no-cache-dir
更新路径
一旦安装,您将希望将$HOME/.local/bin
添加到您的路径中,如果
还没有:
echo 'export PATH=${HOME}/.local/bin:${PATH}' >>${HOME}/.bashrc
测试
检查一切是否顺利:
cca version
应提供chaim cli的当前版本号。
Mac OSX
安装python3
最近,管理自制程序的人更改了默认的python 与操作系统提供的python冲突。看这个自制的 discussion。 所以,要获得python3(并保留python2),现在需要执行以下操作:
brew upgrade python
brew install python2
它将安装python3和python2的最新版本。
安装CCA
要安装chaim cli:
pip install chaim-cli --upgrade --user --no-cache-dir
更新路径
一旦安装,您将希望将$HOME/Library/.Python/3.7/bin
添加到您的路径中,如果
还没有(根据您的情况调整版本):
echo 'export PATH=${HOME}/Library/Python/3.7/bin:${PATH}' >>${HOME}/.bashrc
测试
检查一切是否顺利:
cca version
应提供chaim cli的当前版本号。
Upgrade
pip3 install chaim-cli --upgrade --user
cca
$ cca --help
Usage: cca [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
account Retrieve credentials for an account
delete delete an accounts credentials
gso obtains a console session url, logs out of...
gui obtains a console session url and opens a...
init Initialises the application for use with...
list list all registered accounts and their expiry...
listall list all accounts available to chaim
listpark list of parked accounts
park removes account from credentials and parks it...
renew Renews all account credentials
setautorenew sets the percentage of time remaining before...
unpark returns an account from parking to...
url obtains a console session url and copies it...
version
cca sub-commands
account
$ cca account --help
Usage: cca account [OPTIONS] ACCOUNT
Retrieve credentials for ACCOUNT account
Options:
-r, --role TEXT optional the role to assume for this account
default: rro
-d, --duration INTEGER optional duration must be between 1-12 or 900-43,200
default 1
-a, --alias TEXT optional alias for the account name, to be used as
the profile name
-D, --default optional set this account to be the default account
profile to use
-R, --region TEXT optional region
-T, --terrible Add support for Terraform/Ansible to the credentials
file
--help Show this message and exit.
-T|--terrible
开关将aws_session_token
键复制到aws_security_token
键。
这确保了ansible和terraform等产品仍然使用aws_security_token
将继续工作。
delete
删除指定帐户的凭据。
gui
此命令生成控制台会话URL并打开浏览器窗口。 凭据将首先自动续订。
gso
此命令生成一个控制台会话url,尝试注销当前的 会话,并打开指向URL的浏览器窗口。 凭据将首先自动续订。
注意:似乎没有任何方法可以使用aws访问浏览器选项卡 在其中运行,因此此进程首先打开一个新选项卡以发出注销 命令,然后使用第二个新选项卡将您登录到新帐户。这将离开 你还有两个标签,对不起。
init
使用从slack获得的用户令牌初始化应用程序。或者 提供slack中的base64编码信息作为参数,或使用命令 被问到相关的问题。
cca init YXBpPTh4eHNDczJmV4cGly...JlZ2lvbj1ldS13ZXN0LTE=
cca has been re-initialised.
Your token will expire in 29 days, 21 hours, 19 minutes and 52 seconds.
或
cca init
api (8xxssu8fs7):
username (chris.allison):
usertoken: ad2f05ed-78d7-xxxx-DDDD-8d90c64f9473
tokenexpires: 1536139015
stage (prod):
region (eu-west-1):
cca has been re-initialised.
Your token will expire in 29 days, 21 hours, 18 minutes and 58 seconds.
list
CCA管理的当前帐户列表及其到期时间。 这还显示了哪个是默认帐户,以及剩余时间的百分比。
listall
所有可用帐户的完整列表。
listpark
列出已停驻的帐户。
$ cca listpark
hbetaus
hprodus
hprod
hbeta
hdev7
park
从凭据中删除帐户,并将其停驻及其定义以备以后使用 使用。
$ cca park extbackup
extbackup account has been parked
renew
这将更新所有托管帐户。
$ cca renew
ignoring awsbilling as it is not managed by cca
account: secadmin-prod, alias: secadmin-prod, role: apu, duration: 4
Updated section secadmin-prod with new keys
updated default account
retrieval took 5 seconds.
account: chsre-dev, alias: chsre-dev, role: apu, duration: 4
Updated section chsre-dev with new keys
retrieval took 6 seconds.
unpark
重新启用帐户并自动续订会话,以便 可立即使用。
$ cca unpark hdev7
account: honeycomb-dev7, alias: hdev7, role: mpu, duration: 1
Updated section honeycomb-dev7 with new keys
retrieval took 7 seconds.
url
此命令生成控制台会话URL并将其复制到剪贴板。 凭据将首先自动续订。
version
显示此应用程序的当前版本。