【问题标题】:AWS boto SQS connection not support profile_nameAWS boto SQS 连接不支持 profile_name
【发布时间】:2015-03-07 00:22:56
【问题描述】:

我有一个包含多个配置文件的凭据文件。在我的脚本中,配置文件名称作为参数传递,所有 connect_xxx 调用都使用该配置文件名称。这一直工作正常 - 直到我尝试连接到 SQS。当我尝试连接到 SQS 时,我得到:TypeError: init() got an unexpected keyword argument 'profile_name'。

例如,下面的代码可以正常工作 - 直到 SQS 连接。是我遗漏了什么,还是 AWS 忘记在 SQS 连接上实现 profile_name?

region_name = 'us-east-1'
profile_name = 'my-valid'
iam_conn = boto.connect_iam(profile_name=profile_name)
s3_conn = boto.connect_s3(profile_name=profile_name)
ec2_conn = boto.ec2.connect_to_region( region_name, profile_name=profile_name )
vpc_conn = boto.vpc.connect_to_region( region_name, profile_name=profile_name )
sqs_conn = boto.sqs.connect_to_region( region_name, profile_name=profile_name )

【问题讨论】:

  • 我刚用 2.36.0 版本试了一下,它可以工作。也许您可以尝试更新?

标签: python amazon-web-services boto amazon-sqs


【解决方案1】:

Boto 能够从 AWS 元数据(使用角色启动 Amazon EC2 实例时使用)或本地凭证文件读取凭证。

这里有很好的例子:

看起来它需要 .boto 文件中的凭据,而不是凭据经常传递的某些其他文件名。

确保您拥有最新版本的 boto。在 Linux 上,执行:sudo pip install boto --upgrade

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-06
    • 2018-10-17
    • 2022-10-17
    • 1970-01-01
    • 1970-01-01
    • 2019-06-06
    • 1970-01-01
    • 2015-08-26
    相关资源
    最近更新 更多