Skip to main content

DeleteObjects for Cloud Storage

DeleteObjects - Amazon Simple Storage Service

Example DeleteObjects request (using AWS S3 CLI)

  • Originally 3 objects exists in this bucket
user@host ~ % aws s3api list-objects --bucket created-in-fl-1

{
    "Contents": [
        {
            "Key": "xxx",
            "LastModified": "2023-10-02T19:11:54.788000+00:00",
            "ETag": "\"2da8bc8e8133ec2af9268515aae59e7a\"",
            "Size": 22905,
            "StorageClass": "STANDARD",
            "Owner": {
                "DisplayName": "xd",
                "ID": "xd"
            }
        },
        {
            "Key": "yyy",
            "LastModified": "2023-10-02T19:11:38.436000+00:00",
            "ETag": "\"2da8bc8e8133ec2af9268515aae59e7a\"",
            "Size": 22905,
            "StorageClass": "STANDARD",
            "Owner": {
                "DisplayName": "xd",
                "ID": "xd"
            }
        },
        {
            "Key": "zzz",
            "LastModified": "2023-10-02T19:11:25.551000+00:00",
            "ETag": "\"2da8bc8e8133ec2af9268515aae59e7a\"",
            "Size": 22905,
            "StorageClass": "STANDARD",
            "Owner": {
                "DisplayName": "xd",
                "ID": "xd"
            }
        }
    ],
    "RequestCharged": null
}

  • Delete 2 objects
user@host ~ % aws s3api delete-objects --delete '{"Objects":[{"Key":"xxx"},{"Key":"yyy"}]}' --bucket created-in-fl-1

{
    "Deleted": [
        {
            "Key": "xxx"
        },
        {
            "Key": "yyy"
        }
    ]
}