How can I give a role permission to call my SQS que?

0

I currently have an Account A that is calling account B (my current account) and assuming a role that gives it permissions to perform operations on SQS such as encrypt and publish messages.

I had to manually modify the SQS permissions to get it to work and allow root access to the current account that the assume role is in.

The issue is, this is overly permissive permissions and I do not want root account access to the SQS if I can avoid it.

I'm wondering if I can add the policy to only accept the role that's being assumed, opposed to a root user credenetial. Is it possible to add a ROLE in place of the USER or will I need to create another user with the role that's being assumed for this to work?

For example, here's my policy


{
  "Version": "2012-10-17",
  "Id": "Queue1_Policy_UUID",
  "Statement": [
    {
      "Sid": "Que",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::<account_id>:root"
      },
      "Action": "sqs:*",
      "Resource": "arn:aws:sqs:us-east-1:<account_id>:<service>"
    }
  ]
}
1 回答
0
已接受的回答

Assuming you still want to use SQS Policies, you should be able to set one up that grants access to a certain role or user from a given account as illustrated in the example below:

{
   "Version": "2012-10-17",
   "Id": "Queue1_Policy_UUID",
   "Statement": [{
      "Sid":"Queue1_AllActions",
      "Effect": "Allow",
      "Principal": {
         "AWS": [
            "arn:aws:iam::111122223333:role/role1",
            "arn:aws:iam::111122223333:user/username1"
         ]
      },
      "Action": "sqs:*",
      "Resource": "arn:aws:sqs:us-east-2:123456789012:queue1"
   }]
}

You can find more information in the documentation

AWS
NZ
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则