Python Boto3 auto-refresh credentials when assuming role

0

I've used the fromTemporaryCredentials before for Javascript, this automatically refreshes temp credential when assuming a role.

For boto3 for python however, we are unable to find this option. Is there a way to autiatically refresh 1 hour credentials when using boto3 when providing secret and key ? I see no good documentation on RefreshableCredentials but my list bucket operation just gets stuck forever when I try to use a sample here :

https://pritul95.github.io/blogs/boto3/2020/08/01/refreshable-boto3-session/
https://dev.to/li_chastina/auto-refresh-aws-tokens-using-iam-role-and-boto3-2cjf .
https://gist.github.com/kapilt/ac8e222081f63ba64e93

1 Resposta
0

Based on the links that you have provided, it seems you have already done quite a good research on this topic and there are so many ways of doing this, but as you are looking for a readymade solution, I came across this sample code, which I tested and worked fine.

Please note that, you may need to tweak it further based on additional requirement as I couldn't find anything on AWS SDK sample for python.

Hope you find this useful.

Abhishek

profile pictureAWS
ESPECIALISTA
respondido há 10 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas