If you need to recursively delete all files in an AWS S3 bucket, then you can do the following:

aws s3 rm --recursive s3://your-bucket-name/foo/bar/

If you only want to delete an specific object from AWS S3:

aws s3 rm s3://your-bucket-name/foo/bar/item.txt

I use the recursive version when cleaning up old deployment artifacts or emptying a bucket before deleting it (you can’t delete a non-empty S3 bucket). Be very careful with this command — there’s no confirmation prompt and no undo. Double-check your bucket name and path before hitting enter. If you want to preview what would be deleted first, add the --dryrun flag to see the list of files without actually removing them.