Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I am getting

An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied

when I try to get a folder from my S3 bucket.

Using this command

aws s3 cp s3://bucket-name/data/all-data/ . --recursive

The IAM permissions for the bucket look like this 

{

"Version": "version_id",

"Statement": [

    {

        "Sid": "some_id",

        "Effect": "Allow",

        "Action": [

            "s3:*"

        ],

        "Resource": [

            "arn:aws:s3:::bucketname/*"

        ]

    }

] }

What do I need to change to be able to copy and ls successfully?

1 Answer

0 votes
by (44.4k points)

You do not have the permission to perform actions on the bucket but on the objects which the bucket comprises. So, you can modify your policy like this:

{

"Version": "version_id",

"Statement": [

    {

        "Sid": "some_id",

        "Effect": "Allow",

        "Action": [

            "s3:*"

        ],

        "Resource": [

            "arn:aws:s3:::bucketname",

            "arn:aws:s3:::bucketname/*"

        ]

    }

] }

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

Browse Categories

...