Ad space (banner)
AD

Got the fundamentals? A structured AWS course is a fast way to level up.

Find AWS courses on Udemy

Affiliate link. Costs you nothing extra.

☁️AWS Lessons
Lesson 21 / 41

Deleting an Object with aws s3 rm

When you want to remove a file from S3, use aws s3 rm. It deletes the object you name.

The syntax is aws s3 rm s3://bucket/key. Add --recursive to delete everything under a prefix.

Running aws s3 rm s3://my-bucket/index.html deletes that object and prints delete: s3://my-bucket/index.html.

A common stumble is running a recursive delete against the wrong prefix. There is no confirmation prompt — check with --dryrun first.

In real work, deletions are usually handled by lifecycle rules that expire old data automatically, rather than by hand.

AWS
Try it (type this into the pseudo terminal)
aws s3 rm s3://my-bucket/index.html

🧑‍💻 You can type this command into the AWS pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)