How to delete an object from an S3 bucket?

To delete an object from an S3 bucket, you can use the AWS Management Console, AWS CLI, or AWS SDKs.

  1. Using AWS Management Console:

    • Go to the S3 section in the AWS Management Console.
    • Click on the bucket from which you want to delete the object.
    • Find the object you want to delete, select it, and click on the "Delete" button.
    • Confirm the deletion when prompted.
  2. Using AWS CLI:

    • Open your terminal or command prompt.
    • Run the following command to delete the object: aws s3 rm s3://bucket-name/object-key

    Replace "bucket-name" with the name of your bucket and "object-key" with the key of the object you want to delete.

  3. Using AWS SDKs (e.g., Python SDK - Boto3):

    • Install the AWS SDK for the programming language you are using.
    • Use the SDK to connect to your S3 bucket and delete the object. For example, in Python with Boto3: import boto3 s3 = boto3.client('s3') s3.delete_object(Bucket='bucket-name', Key='object-key')

    Replace "bucket-name" with the name of your bucket and "object-key" with the key of the object you want to delete.

After deleting the object, it may take some time for the deletion to be reflected in the S3 bucket.