-3

I can successfully upload the file from AWS console (UI) to the S3 bucket, but when I try to upload the file from my CLI using command:

aws s3 sync d1/ s3://<s3-bucket>/test-directory

I am getting this error:

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

2
  • 1
    What are the permissions of the AWS credentials you are using with the awscli? Commented Oct 22, 2023 at 21:15
  • You can check what credentials are being used in the AWS CLI by running the aws iam get-user command (with no additional parameters). This will show you which IAM entity is being used by the AWS CLI to make API calls to AWS. Based on the behaviour you describe, it is likely that this will be a different user that the one you use to login to the AWS management console. Commented Oct 23, 2023 at 1:37

1 Answer 1

0

This is solved. The issue was that I had specified policy for the objects but not for the bucket itself.

Refer this answer: https://stackoverflow.com/a/38775442/12833440

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.