Score:0

S3 access control based on bucket tags

cn flag

i hope you can help me out. I have read a couple of docs now, and I am still unsure whether this actually works.

I want to give access in different levels to AWS users based on S3 tags.

Example:

  • S3 bucket mybucket has tags {"access-team-dev": "rwd"}, which should lead to the "dev" team having "read, write, delete" access.
  • one tag for each team, the value is the access level.

I have tried at least 10 different combinations of this IAM policy:

[
    {
        "Action": [ "a lot of actions removed for brevity" ],
        "Condition": {
            "StringEquals": {"aws:ResourceTag/access-team-dev": ["list","ro","rw","rwd"]}
        },
        "Effect": "Allow",
        "Resource": "*"
    },
    {
        "Action": [ "a lot of actions removed for brevity" ],
        "Condition": {
            "StringEquals": {"aws:ResourceTag/access-team-dev": ["ro","rw","rwd"]}
        },
        "Effect": "Allow",
        "Resource": "*"
    },
    {
        "Action": [ "a lot of actions removed for brevity" ],
        "Condition": {
            "StringEquals": {"aws:ResourceTag/access-team-dev": ["rw","rwd"]}
        },
        "Effect": "Allow",
        "Resource": "*"
    },
    {
        "Action": [ "a lot of actions removed for brevity" ],
        "Condition": {
            "StringEquals": {"aws:ResourceTag/access-team-dev": ["rwd"]}
        },
        "Effect": "Allow",
        "Resource": "*"
    }
]

... but nothing works.

That policy is assigned to the user via a IAM group, the test bucket is tagged with "access-team-dev": "rwd".

Two questions:

  • does that work at all??
  • if yes, what am i doing wrong???

Really frustrating, cause according to the docs - if I read them correctly - this should work, right?

Thanks for all answers in advance!

Score:0
cn flag

Well, after a lot more googling I found this StackOverflow post, which references these AWS docs. Implicitly it seems that there is no way to grant bucket level access using tags, whereas you can grant object level access.

Which means, given you have access to a bucket, you can control which objects a user can Read/Write/etc. (based on the ...ObjectTag conditions).

At least I think that is the current state of things. Which is unfortunate, but apparently true.

Date of writing: 2022-12-09

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.