S3 / Client / list_multipart_uploads

list_multipart_uploads#

S3.Client.list_multipart_uploads(**kwargs)#

This action lists in-progress multipart uploads. An in-progress multipart upload is a multipart upload that has been initiated using the Initiate Multipart Upload request, but has not yet been completed or aborted.

This action returns at most 1,000 multipart uploads in the response. 1,000 multipart uploads is the maximum number of uploads a response can include, which is also the default value. You can further limit the number of uploads in a response by specifying the max-uploads parameter in the response. If additional multipart uploads satisfy the list criteria, the response will contain an IsTruncated element with the value true. To list the additional multipart uploads, use the key-marker and upload-id-marker request parameters.

In the response, the uploads are sorted by key. If your application has initiated more than one multipart upload using the same object key, then uploads in the response are first sorted by key. Additionally, uploads are sorted in ascending order within each key by the upload initiation time.

For more information on multipart uploads, see Uploading Objects Using Multipart Upload.

For information on permissions required to use the multipart upload API, see Multipart Upload and Permissions.

The following operations are related to ListMultipartUploads:

See also: AWS API Documentation

Request Syntax

response = client.list_multipart_uploads(
    Bucket='string',
    Delimiter='string',
    EncodingType='url',
    KeyMarker='string',
    MaxUploads=123,
    Prefix='string',
    UploadIdMarker='string',
    ExpectedBucketOwner='string'
)
Parameters:
  • Bucket (string) –

    [REQUIRED]

    The name of the bucket to which the multipart upload was initiated.

    When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.*Region*.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.

    When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When you use this action with S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the Amazon S3 User Guide.

  • Delimiter (string) –

    Character you use to group keys.

    All keys that contain the same string between the prefix, if specified, and the first occurrence of the delimiter after the prefix are grouped under a single result element, CommonPrefixes. If you don’t specify the prefix parameter, then the substring starts at the beginning of the key. The keys that are grouped under CommonPrefixes result element are not returned elsewhere in the response.

  • EncodingType (string) – Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response.

  • KeyMarker (string) –

    Together with upload-id-marker, this parameter specifies the multipart upload after which listing should begin.

    If upload-id-marker is not specified, only the keys lexicographically greater than the specified key-marker will be included in the list.

    If upload-id-marker is specified, any multipart uploads for a key equal to the key-marker might also be included, provided those multipart uploads have upload IDs lexicographically greater than the specified upload-id-marker.

  • MaxUploads (integer) – Sets the maximum number of multipart uploads, from 1 to 1,000, to return in the response body. 1,000 is the maximum number of uploads that can be returned in a response.

  • Prefix (string) – Lists in-progress uploads only for those keys that begin with the specified prefix. You can use prefixes to separate a bucket into different grouping of keys. (You can think of using prefix to make groups in the same way you’d use a folder in a file system.)

  • UploadIdMarker (string) – Together with key-marker, specifies the multipart upload after which listing should begin. If key-marker is not specified, the upload-id-marker parameter is ignored. Otherwise, any multipart uploads for a key equal to the key-marker might be included in the list only if they have an upload ID lexicographically greater than the specified upload-id-marker.

  • ExpectedBucketOwner (string) – The account ID of the expected bucket owner. If the bucket is owned by a different account, the request fails with the HTTP status code 403 Forbidden (access denied).

Return type:

dict

Returns:

Response Syntax

{
    'Bucket': 'string',
    'KeyMarker': 'string',
    'UploadIdMarker': 'string',
    'NextKeyMarker': 'string',
    'Prefix': 'string',
    'Delimiter': 'string',
    'NextUploadIdMarker': 'string',
    'MaxUploads': 123,
    'IsTruncated': True|False,
    'Uploads': [
        {
            'UploadId': 'string',
            'Key': 'string',
            'Initiated': datetime(2015, 1, 1),
            'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'STANDARD_IA'|'ONEZONE_IA'|'INTELLIGENT_TIERING'|'GLACIER'|'DEEP_ARCHIVE'|'OUTPOSTS'|'GLACIER_IR',
            'Owner': {
                'DisplayName': 'string',
                'ID': 'string'
            },
            'Initiator': {
                'ID': 'string',
                'DisplayName': 'string'
            },
            'ChecksumAlgorithm': 'CRC32'|'CRC32C'|'SHA1'|'SHA256'
        },
    ],
    'CommonPrefixes': [
        {
            'Prefix': 'string'
        },
    ],
    'EncodingType': 'url'
}

Response Structure

  • (dict) –

    • Bucket (string) –

      The name of the bucket to which the multipart upload was initiated. Does not return the access point ARN or access point alias if used.

    • KeyMarker (string) –

      The key at or after which the listing began.

    • UploadIdMarker (string) –

      Upload ID after which listing began.

    • NextKeyMarker (string) –

      When a list is truncated, this element specifies the value that should be used for the key-marker request parameter in a subsequent request.

    • Prefix (string) –

      When a prefix is provided in the request, this field contains the specified prefix. The result contains only keys starting with the specified prefix.

    • Delimiter (string) –

      Contains the delimiter you specified in the request. If you don’t specify a delimiter in your request, this element is absent from the response.

    • NextUploadIdMarker (string) –

      When a list is truncated, this element specifies the value that should be used for the upload-id-marker request parameter in a subsequent request.

    • MaxUploads (integer) –

      Maximum number of multipart uploads that could have been included in the response.

    • IsTruncated (boolean) –

      Indicates whether the returned list of multipart uploads is truncated. A value of true indicates that the list was truncated. The list can be truncated if the number of multipart uploads exceeds the limit allowed or specified by max uploads.

    • Uploads (list) –

      Container for elements related to a particular multipart upload. A response can contain zero or more Upload elements.

      • (dict) –

        Container for the MultipartUpload for the Amazon S3 object.

        • UploadId (string) –

          Upload ID that identifies the multipart upload.

        • Key (string) –

          Key of the object for which the multipart upload was initiated.

        • Initiated (datetime) –

          Date and time at which the multipart upload was initiated.

        • StorageClass (string) –

          The class of storage used to store the object.

        • Owner (dict) –

          Specifies the owner of the object that is part of the multipart upload.

          • DisplayName (string) –

            Container for the display name of the owner. This value is only supported in the following Amazon Web Services Regions:

            • US East (N. Virginia)

            • US West (N. California)

            • US West (Oregon)

            • Asia Pacific (Singapore)

            • Asia Pacific (Sydney)

            • Asia Pacific (Tokyo)

            • Europe (Ireland)

            • South America (São Paulo)

          • ID (string) –

            Container for the ID of the owner.

        • Initiator (dict) –

          Identifies who initiated the multipart upload.

          • ID (string) –

            If the principal is an Amazon Web Services account, it provides the Canonical User ID. If the principal is an IAM User, it provides a user ARN value.

          • DisplayName (string) –

            Name of the Principal.

        • ChecksumAlgorithm (string) –

          The algorithm that was used to create a checksum of the object.

    • CommonPrefixes (list) –

      If you specify a delimiter in the request, then the result returns each distinct key prefix containing the delimiter in a CommonPrefixes element. The distinct key prefixes are returned in the Prefix child element.

      • (dict) –

        Container for all (if there are any) keys between Prefix and the next occurrence of the string specified by a delimiter. CommonPrefixes lists keys that act like subdirectories in the directory specified by Prefix. For example, if the prefix is notes/ and the delimiter is a slash (/) as in notes/summer/july, the common prefix is notes/summer/.

        • Prefix (string) –

          Container for the specified common prefix.

    • EncodingType (string) –

      Encoding type used by Amazon S3 to encode object keys in the response.

      If you specify encoding-type request parameter, Amazon S3 includes this element in the response, and returns encoded key name values in the following response elements:

      Delimiter, KeyMarker, Prefix, NextKeyMarker, Key.

Examples

The following example lists in-progress multipart uploads on a specific bucket.

response = client.list_multipart_uploads(
    Bucket='examplebucket',
)

print(response)

Expected Output:

{
    'Uploads': [
        {
            'Initiated': datetime(2014, 5, 1, 5, 40, 58, 3, 121, 0),
            'Initiator': {
                'DisplayName': 'display-name',
                'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'Key': 'JavaFile',
            'Owner': {
                'DisplayName': 'display-name',
                'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'StorageClass': 'STANDARD',
            'UploadId': 'examplelUa.CInXklLQtSMJITdUnoZ1Y5GACB5UckOtspm5zbDMCkPF_qkfZzMiFZ6dksmcnqxJyIBvQMG9X9Q--',
        },
        {
            'Initiated': datetime(2014, 5, 1, 5, 41, 27, 3, 121, 0),
            'Initiator': {
                'DisplayName': 'display-name',
                'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'Key': 'JavaFile',
            'Owner': {
                'DisplayName': 'display-name',
                'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'StorageClass': 'STANDARD',
            'UploadId': 'examplelo91lv1iwvWpvCiJWugw2xXLPAD7Z8cJyX9.WiIRgNrdG6Ldsn.9FtS63TCl1Uf5faTB.1U5Ckcbmdw--',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}

The following example specifies the upload-id-marker and key-marker from previous truncated response to retrieve next setup of multipart uploads.

response = client.list_multipart_uploads(
    Bucket='examplebucket',
    KeyMarker='nextkeyfrompreviousresponse',
    MaxUploads='2',
    UploadIdMarker='valuefrompreviousresponse',
)

print(response)

Expected Output:

{
    'Bucket': 'acl1',
    'IsTruncated': True,
    'KeyMarker': '',
    'MaxUploads': '2',
    'NextKeyMarker': 'someobjectkey',
    'NextUploadIdMarker': 'examplelo91lv1iwvWpvCiJWugw2xXLPAD7Z8cJyX9.WiIRgNrdG6Ldsn.9FtS63TCl1Uf5faTB.1U5Ckcbmdw--',
    'UploadIdMarker': '',
    'Uploads': [
        {
            'Initiated': datetime(2014, 5, 1, 5, 40, 58, 3, 121, 0),
            'Initiator': {
                'DisplayName': 'ownder-display-name',
                'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'Key': 'JavaFile',
            'Owner': {
                'DisplayName': 'mohanataws',
                'ID': '852b113e7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'StorageClass': 'STANDARD',
            'UploadId': 'gZ30jIqlUa.CInXklLQtSMJITdUnoZ1Y5GACB5UckOtspm5zbDMCkPF_qkfZzMiFZ6dksmcnqxJyIBvQMG9X9Q--',
        },
        {
            'Initiated': datetime(2014, 5, 1, 5, 41, 27, 3, 121, 0),
            'Initiator': {
                'DisplayName': 'ownder-display-name',
                'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'Key': 'JavaFile',
            'Owner': {
                'DisplayName': 'ownder-display-name',
                'ID': 'examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484be31bebcc',
            },
            'StorageClass': 'STANDARD',
            'UploadId': 'b7tZSqIlo91lv1iwvWpvCiJWugw2xXLPAD7Z8cJyX9.WiIRgNrdG6Ldsn.9FtS63TCl1Uf5faTB.1U5Ckcbmdw--',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}