Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws s3 cp errors when "-" stream to stdout option is used with a prefix #1771

Closed
davidwarshaw opened this issue Feb 3, 2016 · 2 comments
Closed
Assignees
Labels
bug This issue is a bug. s3stream

Comments

@davidwarshaw
Copy link
Contributor

aws-cli/1.10.1 Python/2.7.6 Darwin/14.3.0 botocore/1.3.23

When used with a prefix, "-" stream to stdout option errors with a 404, with or without --recursive flag.

> aws s3 ls s3://my-bucket/my-prefix --recursive
my-prefix/_SUCCESS
my-prefix/part-00000
my-prefix/part-00001
...
> aws s3 cp s3://my-bucket/my-prefix/part-00000 -
My data row 1
My data row 2
My data row 3
...
> aws s3 cp s3://my-bucket/my-prefix -
A client error (404) occurred when calling the HeadObject operation: Not Found
> aws s3 cp s3://my-bucket/my-prefix - --recursive
A client error (404) occurred when calling the HeadObject operation: Not Found

If this use of the option is not allowed, perhaps the documentation should be updated to reflect.

@jamesls
Copy link
Member

jamesls commented Feb 3, 2016

The first case:

> aws s3 cp s3://my-bucket/my-prefix -
A client error (404) occurred when calling the HeadObject operation: Not Found

doesn't seem like the CLI can really do much with that. We interpret that as you wanting to download the s3://mybucket/my-prefix key to stdout. We have no way of knowing that you meant a prefix. It's the same situation if you have aws s3 cp s3://bucket/somekey /tmp/myfile. We assume you want to download the somekey file to /tmp/myfile.

The second case with the --recursive option on the other hand, seems like something we should be able to validate. If you want to stream to stdout, then --recursive should not be allowed and we should error out.

@jamesls jamesls added bug This issue is a bug. s3stream labels Feb 3, 2016
@davidwarshaw
Copy link
Contributor Author

I agree with the reasoning to leave behavior as is for the case without --recursive.

When --recursive is used, I would have expected the behavior to be idiomatic with the other options and commands. Traverse the prefix in whatever the normal order is, streaming each key to stdout.

Barring this, I agree with erroring out at argument parsing with a good message, and adding a line to the docs for each option, specifying that they can't be used together.

@kyleknap kyleknap self-assigned this Mar 7, 2016
thoward-godaddy pushed a commit to thoward-godaddy/aws-cli that referenced this issue Feb 12, 2022
* Upgrade aws-lambda-builders dependency

* Update Both Dependency Files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. s3stream
Projects
None yet
Development

No branches or pull requests

3 participants