Skip to content

User cannot use s3:ListAllMyBuckets even though he has it.

0

Hello, I am trying to setup an account to backup my NAS into a S3 bucket. I've created a IAM user with no console access, created a politic with those rules :

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "VisualEditor0",
			"Effect": "Allow",
			"Action": "s3:ListBucket",
			"Resource": "arn:aws:s3:::mybucket"
		},
		{
			"Sid": "VisualEditor1",
			"Effect": "Allow",
			"Action": "s3:*Object",
			"Resource": "arn:aws:s3:::mybucket/*"
		},
		{
			"Sid": "VisualEditor2",
			"Effect": "Allow",
			"Action": "s3:ListAllMyBuckets",
			"Resource": "arn:aws:s3:::*"
		}
	]
}

I still get an error saying :

AccessDenied: User: arn:aws:iam::123456789:user/myuser is not authorized to perform: s3:ListAllMyBuckets because no identity-based policy allows the s3:ListAllMyBuckets action

Thanks for the help.

3 Answers
0

The issue you're experiencing is related to how the s3:ListAllMyBuckets permission is configured in your policy. While you've included this permission, there's a problem with how the resource is specified for this action.

For the s3:ListAllMyBuckets action, you need to specify the resource as * rather than arn:aws:s3:::*. The s3:ListAllMyBuckets action operates at the AWS service level, not at the bucket level, so it requires a different resource specification.

Here's how you should modify the third statement in your policy:

{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
}

This change should resolve the "AccessDenied" error you're encountering when trying to list all buckets. The rest of your policy looks correct for allowing access to list the specific bucket and perform object operations within that bucket.
Sources
Bucket policies for Amazon S3 - Amazon Simple Storage Service
Amazon S3: Restrict management to a specific S3 bucket - AWS Identity and Access Management

answered a year ago

EXPERT

reviewed a year ago

  • I already tried to use "Resource": "*" and I have the same error.

0

I think your permissions are getting blocked by SCP or your role has a permission boundary that is blocking the permission. I have tested and the permissions look ok. Also, you can use the policy simulator tool to determine whether the permission are correct.

policy simulator tool :

Policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "s3:ListAllMyBuckets",
            "Resource": "*"
        }
    ]
}

Screen shotEnter image description here

EXPERT

answered a year ago

0

If "Permission Boundary" is set on your IAM user then make sure the following policy is attached in your Permission boundary policy as well:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "s3:ListAllMyBuckets",
            "Resource": "*"
        }
    ]
}

To check the Permission Boundary policy of your IAM user, Follow below steps on AWS Management Console:

  1. Open the IAM Console Home page
  2. In the navigation pane, choose Users.
  3. In the Users list, choose the name of the IAM user whose permissions boundary you want to Edit/view.
  4. Choose the Permissions tab. Scroll down and open the Permissions boundary section.

Note: If permission boundary is not set, this section will display the title as "Permissions boundary (not set)"

AWS
SUPPORT ENGINEER

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.