0 votes
1 view
in AWS by (19.2k 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.6k 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/*"

        ]

    }

] }

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...