gpt4 book ai didi

AWS: How to assume role and set credentials to all consecutive client calls(AWS:如何承担角色并为所有连续的客户端调用设置凭据)

转载 作者:bug小助手 更新时间:2023-10-24 22:23:34 25 4
gpt4 key购买 nike



The case: Multitenant C++ application using AWS C++ SDK, it processes jobs that may belong to multiple tennats account and each time I should assume another role and make somehow our infra to work with new credentials, the problem that I cant start passing new credentials to zillion functions.
I know how to assume role using AWS C++ SDK, but is it possible to set these credentials as default for all consecutive calls for all existing clients (S3Client, for example) on process/thread level?

案例:使用AWS C++SDK的多租户C++应用程序,它处理可能属于多个Tennat帐户的作业,每次我应该承担另一个角色并以某种方式使我们的基础设施使用新凭据,问题是我无法开始向无数函数传递新凭据。我知道如何使用AWS C++SDK承担角色,但是否可以将这些凭据设置为进程/线程级别上所有现有客户端(例如S3Client)的所有连续调用的默认凭据?


更多回答
优秀答案推荐

When you create a AWS-SDK client, you have the option to pass in an implementation of a credentials provider

创建AWS-SDK客户端时,您可以选择传入凭据提供程序的实现



  1. Your implementation of the credentials provider would basically use a AssumeRole provider.

  2. You can create a manual client cache which maps new AWS Clients to accounts, so you create a new one with the assume role provider once if it has not been created yet.

  3. To avoid having a thousand HTTP Clients sitting around, you can use configure all your SDK Client objects to use the same underlying client.


更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com