Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 310
ehime Avatar asked Mar 30 '15 19:03

ehime


Video Answer


1 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
like image 171
tedder42 Avatar answered Sep 22 '22 15:09

tedder42