AWS auth,使用temp saml auth密钥通过boto3进行身份验证

时间:2019-10-17 00:37:33

标签: python-3.x amazon-web-services boto3 saml-2.0

使用临时SAML身份验证,在运行python代码和导入boto3时无法找到AWS凭证

我可以登录到SAML帐户并使用AWS cli正常进行身份验证并指定其他配置文件。

试图设置AWS_CREDENTIALS_PATH ='〜/ .aws / credentials'并拾取临时创建的密钥,需要配置文件前缀

#!/usr/bin/env python3
import boto3

AWS_CREDENTIALS_PATH = '~/.aws/credentials'
OPENAM_SEARCH_STRING = 'XUI/#login/&'


session = boto3.Session(profile_name='Admin_Profile')
# Any clients created from this session will use credentials

# Let's use Amazon S3
s3 = boto3.resource('s3')

# Print out bucket names
for bucket in s3.buckets.all():
    print(bucket.name)

期望找到信誉并登录。

Error Received:

in add_auth
    raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials

0 个答案:

没有答案