0
I取得するには、次のエラー、AWS CLIコマンドを実行するとき:aws ec2 describe-instances --filters "Name=instance-type,Values=m1.small"
:(CLIを使用)AWSが提供されたアクセス資格情報を検証することができませんでした
A client error (AuthFailure) occurred when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials
資格情報は、次のスクリプトからのものを
import boto3
sts_client = boto3.client('sts')
assumedRoleObject = sts_client.assume_role(
RoleArn="arn:aws:iam::<>:role/service-role/Test-Project",
RoleSessionName="AssumeRoleSession2"
)
credentials = assumedRoleObject['Credentials']
print credentials['AccessKeyId']
print "#"*100
print credentials['SecretAccessKey']
print "#"*100
print credentials['SessionToken']
print "#"*100
私はロールでAdmin Accessを有効にしてテストしました。まだ動かない。
次のような役割の信頼関係は次のとおりです。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"*",
"arn:aws:iam::<>:user/<username>"
],
"Service": [
"lambda.amazonaws.com",
"ec2.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}
あなたは 'AWS IAMのget-user'から何を得るのですか? –
@AdamOwczarczyk GetUser操作を呼び出すと、クライアントエラー(InvalidClientTokenId)が発生しました:リクエストに含まれているセキュリティトークンが無効です。 ' – Dawny33
あなたの 'aws configure'が間違っていました。セッショントークンが無効であるか、セッショントークンが非常に短い期間に設定されているためタイムアウトしました。 Manishの答えはより詳細です。 –