aws-serverless-workshops: Copying the wildrydes files from s3 fails with access denied

Following the “build a serverless web app” tutorial, and hit two issues in the Copy the files from S3 step in Module 1 - Static Web Hosting with Continuous Deployment.

Firstly, the pre-requisites for the tutorial didn’t mention the need to install the aws cli, so I had to go and figure that out (more an annoyance than a blocker, as a quick Google for “aws cli” sorted that).

Then once the CLI is installed, running the aws s3 cp s3://wildrydes-us-east-1/WebApplication/1_StaticWebHosting/website ./ --recursive command as instructed results in this error:

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

I assume the target S3 bucket is no longer publicly available…

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 9
  • Comments: 27

Most upvoted comments

the problem is that the s3 bucketv isn’t publicly accessible anymore. in order to find it check it here aws s3 cp s3://ttt-wildrydes/wildrydes-site ./ --recursive

Hi @daiscog - I had the same problem. I resolved it by granting the IAM user that was doing the copy the AmazonS3ReadOnlyAccess policy - this gave the user permission to read from S3.

Following the “build a serverless web app” tutorial, and hit two issues in the Copy the files from S3 step in Module 1 - Static Web Hosting with Continuous Deployment.

Firstly, the pre-requisites for the tutorial didn’t mention the need to install the aws cli, so I had to go and figure that out (more an annoyance than a blocker, as a quick Google for “aws cli” sorted that).

Then once the CLI is installed, running the aws s3 cp s3://wildrydes-us-east-1/WebApplication/1_StaticWebHosting/website ./ --recursive command as instructed results in this error:

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

I assume the target S3 bucket is no longer publicly available…

as at today 13th February 2024, I still have this issue

Ok so the solution is a few things:

  1. For the IAM user, ensure you added the Access key ID and secret in your environment. You can check it on cat ~/.aws/credentials
  1. For the IAM user, ensure you have AmazonS3ReadOnlyAccess permission

the problem is that the s3 bucketv isn’t publicly accessible anymore. in order to find it check it here aws s3 cp s3://ttt-wildrydes/wildrydes-site ./ --recursive

AccessDenied error is gone but now when I git push, here’s the new error:

fatal: repository ‘https://git-codecommit.us-west-2.amazonaws.com/v1/repos/wildrydes-site/’ not found

Change the remote URL by running: git remote set-url origin https://git-codecommit.us-east-1.amazonaws.com/v1/repos/wildrydes-site

then run

git push

Adding AmazonS3ReadOnlyAccess policy did not work for me

@phmohan I had to wait a few minutes after granting the IAM user AmazonS3ReadOnlyAccess before it took effect and I was able to copy the files from the S3 bucket.

it works

the problem is that the s3 bucketv isn’t publicly accessible anymore. in order to find it check it here aws s3 cp s3://ttt-wildrydes/wildrydes-site ./ --recursive

AccessDenied error is gone but now when I git push, here’s the new error: fatal: repository ‘https://git-codecommit.us-west-2.amazonaws.com/v1/repos/wildrydes-site/’ not found

create a new repo and start all over again , with the git clone etc process. Also make sure you are in the us-west-2 region this is very important . I had to change my region and created the repo in this region

Tried changing region to us-west-2 and doing all over again but didn’t help. When I git push to CodeCommit repository, after it asks credentials, I get this error again:

fatal: repository ‘https://git-codecommit.us-west-2.amazonaws.com/v1/repos/wildrydes-site/’ not found

did you name the repo you created in the us-west-2 region " wildrydes-site " when I had similar issues, I deleted the repos there, started again and named my repo “wildrydes-site” not " wildrydes-site2 "

@ranaalisaeed , I have done no2, and it did not work, how can I go about doing no1

Ok so the solution is a few things:

  1. For the IAM user, ensure you added the Access key ID and secret in your environment. You can check it on cat ~/.aws/credentials

  2. For the IAM user, ensure you have AmazonS3ReadOnlyAccess permission