allada / bsc-archive-snapshot

Free public Binance Smart Chain (BSC) Archive Snapshot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS fatal error: Unable to locate credentials

Chiray1 opened this issue · comments

Hey,
I'm new to AWS and just tried your script. However, the download for the parlia database fails with the error Unable to locate credentials.
When I run aws s3 ls it doesn't give back The AWS Access Key Id you provided does not exist in our records. So I'm guessing this command can find the keys.
I have created a new access key and plugged it in with aws configure. Is there any more steps I need to do?

Thanks in advance!

Are you sure that is the only file that fails? The public policy is on the entire bucket, so that would be strange.

Make sure the credentials are on root user and launch the script as root.

I have this same issue, says credentials not found (not just on parlia). Running everything on sudo/root. First I tried aws configure, both as a regular user and and root. When that failed, I tried configuring the credentials as environment variables. When that failed, I tried switching to the root user and manually creating the configuration files in the root user home directory, and when that failed, I put the same files in the regular user's home directory too. All failed.

aws configure list shows the proper credentials.

This is how the error appears:

+ mkdir -p /erigon/data/bsc/snapshots/
+ aws s3 sync --request-payer requester s3://public-blockchain-snapshots/bsc/erigon-nodes-folder-latest/ /erigon/data/bsc/nodes/
+ return
+ aws s3 cp --request-payer requester s3://public-blockchain-snapshots/bsc/parlia-db-latest.mdbx.zstd -
+ pzstd -d -o /erigon/data/bsc/parlia/mdbx.dat
+ aws configure set s3.max_concurrent_requests 100 --profile erigon-more-concurrent-requests
pzstd: /erigon/data/bsc/parlia/mdbx.dat already exists; do you wish to overwrite (y/n) ? + aws s3 sync --profile erigon-more-concurrent-requests --request-payer requester s3://public-blockchain-snapshots/bsc/erigon-snapshots-folder-latest/ /erigon/data/bsc/snapshots/
fatal error: Unable to locate credentials

This is what aws configure list returns:

      Name                    Value        Type    Location
      ----                    -----             ----    --------
   profile                <not set>        None    None
access_key     ****************       shared-credentials-file
secret_key     ****************       shared-credentials-file
    region                us-east-1      config-file    ~/.aws/config

Did you try sudo aws configure? You probably didn't run it with sudo, but are running the command with sudo.

Did you try sudo aws configure? You probably didn't run it with sudo, but are running the command with sudo.

Yes, I tried it both ways.

I suggest bypassing sudo and use:
sudo su root

Then run aws configure and the script without sudo. This will allieve any ambiguity

I suggest bypassing sudo and use: sudo su root

Then run aws configure and the script without sudo. This will allieve any ambiguity

I tried that too. The only difference that this makes is that after it fails to find the credentials, it continues and tries to download another file:

...
fatal error: Unable to locate credentials
root@ip-xxxxxxxxxx:/home/ubuntu/bsc-archive-snapshot# pzstd: -: Not overwritten.
download failed: s3://public-blockchain-snapshots/bsc/parlia-db-latest.mdbx.zstd to - [Errno 32] Broken pipe
+ true

Then it just stops doing anything.

Try aws sts get-caller-identity if this does not work it's a problem with the aws command. AWS themselves have done pretty good documentation on trouble shooting this.

Try aws sts get-caller-identity if this does not work it's a problem with the aws command. AWS themselves have done pretty good documentation on trouble shooting this.

It's responding with the correct info on that command. But when the aws s3 command is run by your script, for some reason it cannot find the credentials.

Hmmm i bet the issue is the profile it creates... Try removing the --profile xxxxxxxx part in the script

Hmmm i bet the issue is the profile it creates... Try removing the --profile xxxxxxxx part in the script

That actually worked! Thanks for the responses.