I am using the terminal to copy a file from an s3 bucket to my local machine but I keep getting the error:
fatal error: An error occurred (404) when calling the HeadObject operation: Key "file_000" does not exist
I am using the command:
usr/local/bin/aws s3 cp s3://{bucket}/file_000 /Users/user/Documents/Docs/dir/new_file.csv
I know the file exists using:
aws s3 ls s3://{bucket} --recursive --human-readable
and shows up as:
2022-08-04 15:53:12 21.2 MiB file_000
I have tried adding --recursive
to the end of the command. The command goes through but then creates an empty directory named new_file.csv
Is there anything I can do to solve this?
aws s3api list-objects --bucket example-bucket --query Contents[].Key
to verify there are no special characters, for instance, keep an eye out for trailing spaces in the key name. – Juni