有没有办法从boto3获取access_key和secret_key? [英] Is there a way to get access_key and secret_key from boto3?
本文介绍了有没有办法从boto3获取access_key和secret_key?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我启动具有IAM角色的EC2实例时,可以在该EC2instance上使用 boto3
,而不必指定AWS访问和密钥,因为 boto3
会自动读取它们.
When I launch an EC2 instance with an IAM role I can use boto3
on that EC2instance and not have to specify aws access and secret keys because boto3
reads them automatically.
>>> import boto3
>>> s3 = boto3.resource("s3")
>>> list(s3.buckets.all())[0]
s3.Bucket(name='my-bucket-name')
问题
我想知道是否有任何方法可以从boto3获取访问密钥和秘密密钥?例如,如何使用 print
I'm wondering if there is any way to get the access key and secret key from boto3? For example, how can I print them on to the standard console using print
推荐答案
确定是( 查看全文