I am trying to assign a role to a user using the AWS console but not having a whole lot of success with it. So I created a user David and I created a role with a trust policy in which I am assigning the David i.e. IAM user as the principal which looks like this:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::Account-ID:user/David" }, "Action": "sts:AssumeRole" } ] } and I also attached a policy to the role which lets the user listbuckets and getobject. The policy looks like this:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Allowsusertotolistbuckets", "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetObject" ], "Resource": "arn:aws:s3:::*" } ] } Now when I run aws configure and authenticate as David user with the right access key and secret access key and run aws s3 ls. I run into the following: An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied. How can I have the user assume the role?