How to delete thousands of objects via aws cli

Introduction

While our user interface is great for managing a few objects, it might become less efficient when dealing with thousands or tens of thousands of objects. In these cases, using the Command Line Interface (CLI) can be much more effective.

How to delete multiple in a bucket of objects using CLI

Step 1. Install AWS CLI

First, you need to install the AWS CLI on your local machine. Follow the instructions in our guide.

Step 2. Configure your profile

Once AWS CLI is installed, you need to configure your profile. This profile includes the security credentials that the AWS CLI uses to interact with AWS services. You can set up your profile by following the instructions in our guide.

Step 3. Run the Delete Command

Now, you're ready to delete multiple objects from your bucket. Please replace the placeholders in the command below with your actual details:

Caution! The --recursive parameter will delete all data within the specified path!

aws s3 rm s3://your-bucket-name/path-to-your-folder-name/ --recursive --profile impossiblecloud --endpoint-url https://us-west-1.storage.impossibleapi.net --region us-west-1
  • s3://your-bucket-name/path-to-your-folder-name/: Replace this with your bucket name and the path to the folder you'd like to clean up.

  • your-profile: Replace this with the name of the profile you created in Step 2.

  • --endpoint-url: Replace this with your endpoint URL.

  • --region: Replace this with your region.

Last updated