0

I am trying to give a federated user ( ADFS + SAML + STS ) access to an Amazon S3 bucket . I am trying to give the principal as

  "Principal": {
                "AWS": [
                    "arn:aws:sts: accountid:federated-user/someuser"
                ]
             }

and

"Resource": "arn:aws:s3:::mybucket"

But I cant seem to get the right access . Any pointers on this

smac2020
  • 9,637
  • 4
  • 24
  • 38
Zak
  • 111
  • 3
  • 11

2 Answers2

3

Does the user assume a specific role first before attempting to access the bucket?

If so, try including both the user and the assumed role in your bucket policy, ie

"AWS": [
  "arn:aws:sts::1234567890:assumed-role/User/joe@example.com",
  "arn:aws:iam::1234567890:role/User"
]

Where User is the role name.

alkalinecoffee
  • 1,003
  • 8
  • 20
1

This might be an old post, but the above answer of @alkalinecoffee did help me figure out the best answer for today

IAM role policies now use Conditions a lot:

{
  "Effect": "Deny",
  "Principal": "*",
  "Action": "s3:*",
  "Resource": [
     "arn:aws:s3:::<s3bucket>",
     "arn:aws:s3:::<s3bucket>/*"
  ],
  Condition = {
    ArnNotEquals = {
      aws:PrincipalArn = [
        "arn:aws:iam::<AccountID>:role/aws-reserved/sso.amazonaws.com/<region>/<rolename>",
        "arn:aws:iam::<AccountID>:assumed-role/<rolename>/<federateduser>"
      ]
   }
}

This will block ALL Users except for the federateduser defined in the ArnNotEquals condition.

Rodel
  • 147
  • 1
  • 6