DEV Community

Kapil Gorve
Kapil Gorve

Posted on • Originally published at jskap.com on

aws cli s3 commands

List buckets

aws s3 ls

Output:
Microsoft Windows [Version 10.0.19041.207]
(c) 2020 Microsoft Corporation. All rights reserved.

D:\work>aws s3 ls
2018-11-22 12:23:27 kapilgorve
2020-01-08 10:36:12 macosimage

D:\work>

List files and folders inside a bucket.

aws s3 ls kapilgorve/

Output:
D:\work>aws s3 ls kapilgorve/
                           PRE all/
                           PRE covers/
                           PRE push-notification-react-native/
2019-04-28 14:03:03 0

D:\work>

Copy single file to s3

aws s3 cp test.jpg s3://kapilgorve/blog/covers/

Copy single file to s3 and make public

aws s3 cp test.jpg s3://kapilgorve/blog/covers/ --acl public-read

Copy complete folder to s3

aws s3 cp myfolder s3://kapilgorve/ --recursive

👋 Hi! I’m Kapil. I am always chatty about building things, sharing my learnings, freelancing. Come say hi to me at https://twitter.com/kapilgorve

Top comments (1)

Collapse
 
andrewdmay profile image
Andrew May

The aws s3 sync command is another useful one, especially after you've uploaded a directory (e.g. a website and made a few changes but don't need to upload all the files again.

Fun fact (the fun is debatable) - there's also the aws s3api CLI set of commands that allow you to configure all the settings on S3 that aren't part of the aws s3 commands.