Issues Copying a Bucketfile to Local Disk

I've ran through the entire sequence that I believe I needed to do, but I am still getting an invalid argument type error while trying to copy my file locally. What am I doing wrong here?

vagrant@dev:~$ aws s3 ls s://bucketname-vagrant

A client error (NoSuchBucket) occurred when calling the ListObjects operation: The specified bucket does not exist

vagrant@dev:~$ aws s3 ls bucketname-vagrant
2015-03-30 14:06:02  285061467 or_vagrant.sql.tar.gz
2015-03-30 13:55:01  102642228 or_vagrant.sql.xz

vagrant@dev:~$ aws s3 ls bucketname-vagrant/or_vagrant.sql.xz
2015-03-30 13:55:01  102642228 or_vagrant.sql.xz
vagrant@dev:~$ aws s3 cp bucketname-vagrant/or_vagrant.sql.xz /tmp/

usage: aws s3 cp <LocalPath> <S3Path> or <S3Path> <LocalPath> or <S3Path> <S3Path>
Error: Invalid argument type

2 Answers

s3 is not deprecated. s3 and s3api are on different tiers. s3api is the API-level, while s3 has the high-level commands.

ls

The problem is that you have a typo in s3:// in your first command.

$ aws s3 ls s://bucketname-vagrant
A client error (NoSuchBucket) occurred when calling the ListObjects operation: The specified bucket does not exist

I can replicate that error with my own bucket. This works:

$ aws s3 ls s3://bucketname-vagrant

#cp

$ aws s3 cp bucketname-vagrant/or_vagrant.sql.xz /tmp/

The problem here is that aws-cli doesn't know if you have a local directory named bucketname-vagrant or not. You can fix that by using the s3:// syntax:

$ aws s3 cp s3://bucketname-vagrant/or_vagrant.sql.xz /tmp/

Again, I replicated that locally.

$ aws s3 cp bucket/test.txt /tmp/
usage: aws s3 cp <LocalPath> <S3Path> or <S3Path> <LocalPath> or <S3Path> <S3Path>
Error: Invalid argument type

$ aws s3 cp s3://bucket/test.txt /tmp/
download: s3://bucket/test.txt to /tmp/keybase.txt
1

Seems to be that S3 is deprecated in favor of s3api, this worked

aws s3api get-object --bucket bucketname-vagrant --key or_vagrant.sql.tar.gz or_vagrant.sql.tar.gz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest