IAM kullanıcı kimlik bilgilerini kullanarak bir IAM rolünü nasıl üstlenebilir?
import boto3
sts_client = boto3.client(
'sts',
aws_access_key_id=ACCESS_KEY,
aws_secret_access_key=SECRET_KEY,
)
)
sts_client.assume_role(RoleArn=some-role, RoleSessionName='boto3_client')
Bazı nedenlerden dolayı yukarıdaki kod üretir:
An error occurred (InvalidClientTokenId) when calling the AssumeRole operation: The security token included in the request is invalid.
Test ettim aws_access_key_id
ve aws_secret_access_key
kullanım aws sts assume-role
ve gerçekten de CLI'Yİ kullanarak bu rolü üstlenebilirim. Neyi yanlış yapıyorum?
Herhangi bir fark yaratırsa, IAM kullanıcısı AWS'nin Çince bölümündedir.