使用 awscli 在 ~/.aws/cli/cache 中有一个凭证缓存,它允许我缓存凭证一段时间。这在使用 MFA 时非常有用。 boto3 是否具有类似的功能,或者我是否必须显式缓存从 session = boto3.session.Session(profile_name='CTO:Admin')
返回的凭据? ?
最佳答案
它已经在那里了。
http://boto3.readthedocs.org/en/latest/guide/configuration.html#assume-role-provider
When you specify a profile that has IAM role configuration, boto3 will make an AssumeRole call to retrieve temporary credentials. Subsequent boto3 API calls will use the cached temporary credentials until they expire, in which case boto3 will automatically refresh credentials. boto3 does not write these temporary credentials to disk. This means that temporary credentials from the AssumeRole calls are only cached in memory within a single Session. All clients created from that session will share the same temporary credentials.
关于amazon-web-services - boto3 是否具有与 awscli 相当的凭证缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35873527/