Without --recursive
:
aws s3 cp ./{DIRECTORY} s3://{BUCKET}/
upload failed: {DIRECTORY}/ to s3://{BUCKET}/ Parameter validation failed:
Invalid length for parameter Key, value: 0, valid range: 1-inf
With --recursive
:
aws s3 cp --recursive ./{DIRECTORY} s3://{BUCKET}/
upload: ...
When searching for that error, the first result on google is about issue #2929 which as been closed for no apparent reason.
This comment says it all https://github.com/aws/aws-cli/issues/2929#issuecomment-393869946
Please improve that message...
Version info:
➜ workspace aws --version
aws-cli/1.15.50 Python/3.7.0 Darwin/17.7.0 botocore/1.10.49
In the aws cli directory, there's a file __init__.pyc that lists about the source directory, bucket and key requirement.
# Upload /tmp/myfile to s3://bucket/key
transfer.upload_file('/tmp/myfile', 'bucket', 'key')
I found that key (i.e. a filename) should be mentioned with the command as in example below. Maybe this could solve your issue.
ex: aws s3 cp test.zip s3://my-bucket/test.zip
Further run the following command to verify if you have configured your credentials.
aws configure list
@DaazKu - Thanks for reaching out and thanks @zeniri for your reply. I have reproduced the Invalid length for parameter Key, value: 0, valid range: 1-inf
error returning without --recursive
when executing aws s3 cp ./{DIRECTORY} s3://{BUCKET}/
. I agree this could use a better error message. Our team is aware of this feature request so I have labeled it as such.
The error message is still not helpful in version:
aws-cli/1.16.111 Python/3.6.0 Windows/8.1 botocore/1.12.101
@ilovecats516 please elaborate the steps you took to get to the above error. Thanks!
Still getting the error:
aws-cli/1.16.140 Python/2.7.16 Darwin/18.2.0 botocore/1.12.130
aws s3 cp . s3://{BUCKET}/ --include "*.yaml"
upload failed: ./ to s3://{BUCKET}/ Parameter validation failed:
Invalid length for parameter Key, value: 0, valid range: 1-inf
@kjenney please elaborate the steps
Most helpful comment
@DaazKu - Thanks for reaching out and thanks @zeniri for your reply. I have reproduced the
Invalid length for parameter Key, value: 0, valid range: 1-inf
error returning without--recursive
when executingaws s3 cp ./{DIRECTORY} s3://{BUCKET}/
. I agree this could use a better error message. Our team is aware of this feature request so I have labeled it as such.