通过管理多个Amazon Web Services(AWS)帐户的最佳方式是什么boto?
我熟悉BotoConfig文件,我正在使用它.但是每个文件只描述一个帐户......而且我的工作不仅仅是一个组织.出于所有常见的法律,财务和安全原因,这些帐户不能混合使用.
目前我在boto每个帐户使用一个配置文件.例如:
~/.boto 默认帐户~/.boto_clowncollege 为"clowncollege"帐户~/.boto_razorassoc 为"razorassoc"帐户~/.boto_xyz 为"xyz"帐户然后像:
def boto_config_path(account=None):
"""
Given an account name, return the path to the corresponding boto
configuration file. If no account given, return the default config file.
"""
path = '~/.boto' + ('_' + account if account else '')
clean_path = os.path.abspath(os.path.expanduser(path))
if os.path.isfile(clean_path):
return clean_path
else:
errmsg = "cannot find boto config file {} for {}".format(clean_path, account)
raise ValueError(errmsg)
def aws_credentials(account=None): …Run Code Online (Sandbox Code Playgroud)