DEV Community

Cover image for Handy AWS S3 CLI commands
Kyle Foo
Kyle Foo

Posted on • Edited on

1

Handy AWS S3 CLI commands

Some of the AWS S3 CLI commands that are handy for getting & writing objects to/from the S3 buckets.

To list data from a S3 folder:
aws s3 ls s3://bucket/folder/subfolder/ --recursive --profile kylefoo

To get object from a S3 bucket:
aws s3api get-object --bucket prod-bucket --key folder/subfolder/remote-file.txt --profile kylefoo local-file.txt

To write object to a S3 file:
aws s3api put-object --bucket prod-bucket --key folder/subfolder/remote-object.json --body local-object.json --profile kylefoo

To remove a specific file type inside a S3 subfolder
aws s3 rm s3://bucket/folder/subfolder/ --recursive --exclude "*" --include "*.txt" --profile kylefoo

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay