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客户端时,您可以选择传入凭据提供程序的实现
- Your implementation of the credentials provider would basically use a AssumeRole provider.
- 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.
- To avoid having a thousand HTTP Clients sitting around, you can use configure all your SDK Client objects to use the same underlying client.
更多回答
我是一名优秀的程序员,十分优秀!