S3 / Client / list_multipart_uploads
list_multipart_uploads#
- S3.Client.list_multipart_uploads(**kwargs)#
This operation lists in-progress multipart uploads in a bucket. An in-progress multipart upload is a multipart upload that has been initiated by the
CreateMultipartUpload
request, but has not yet been completed or aborted.Note
Directory buckets - If multipart uploads in a directory bucket are in progress, you can’t delete the bucket until all the in-progress multipart uploads are aborted or completed.
The
ListMultipartUploads
operation returns a maximum of 1,000 multipart uploads in the response. The limit of 1,000 multipart uploads is also the default value. You can further limit the number of uploads in a response by specifying themax-uploads
request parameter. If there are more than 1,000 multipart uploads that satisfy yourListMultipartUploads
request, the response returns anIsTruncated
element with the value oftrue
, aNextKeyMarker
element, and aNextUploadIdMarker
element. To list the remaining multipart uploads, you need to make subsequentListMultipartUploads
requests. In these requests, include two query parameters:key-marker
andupload-id-marker
. Set the value ofkey-marker
to theNextKeyMarker
value from the previous response. Similarly, set the value ofupload-id-marker
to theNextUploadIdMarker
value from the previous response.Note
Directory buckets - The
upload-id-marker
element and theNextUploadIdMarker
element aren’t supported by directory buckets. To list the additional multipart uploads, you only need to set the value ofkey-marker
to theNextKeyMarker
value from the previous response.For more information about multipart uploads, see Uploading Objects Using Multipart Upload in the Amazon S3 User Guide.
Note
Directory buckets - For directory buckets, you must make requests for this API operation to the Zonal endpoint. These endpoints support virtual-hosted-style requests in the format ``https://bucket_name.s3express-az_id.region.amazonaws.com/key-name ``. Path-style requests are not supported. For more information, see Regional and Zonal endpoints in the Amazon S3 User Guide.
Permissions
General purpose bucket permissions - For information about permissions required to use the multipart upload API, see Multipart Upload and Permissions in the Amazon S3 User Guide.
Directory bucket permissions - To grant access to this API operation on a directory bucket, we recommend that you use the CreateSession API operation for session-based authorization. Specifically, you grant the
s3express:CreateSession
permission to the directory bucket in a bucket policy or an IAM identity-based policy. Then, you make theCreateSession
API call on the bucket to obtain a session token. With the session token in your request header, you can make API requests to this operation. After the session token expires, you make anotherCreateSession
API call to generate a new session token for use. Amazon Web Services CLI or SDKs create session and refresh the session token automatically to avoid service interruptions when a session expires. For more information about authorization, see CreateSession.Sorting of multipart uploads in response
General purpose bucket - In the
ListMultipartUploads
response, the multipart uploads are sorted based on two criteria:Key-based sorting - Multipart uploads are initially sorted in ascending order based on their object keys.
Time-based sorting - For uploads that share the same object key, they are further sorted in ascending order based on the upload initiation time. Among uploads with the same key, the one that was initiated first will appear before the ones that were initiated later.
Directory bucket - In the
ListMultipartUploads
response, the multipart uploads aren’t sorted lexicographically based on the object keys.HTTP Host header syntax
Directory buckets - The HTTP Host header syntax is
Bucket_name.s3express-az_id.region.amazonaws.com
.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', RequestPayer='requester' )
- Parameters:
Bucket (string) –
[REQUIRED]
The name of the bucket to which the multipart upload was initiated.
Directory buckets - When you use this operation with a directory bucket, you must use virtual-hosted-style requests in the format
Bucket_name.s3express-az_id.region.amazonaws.com
. Path-style requests are not supported. Directory bucket names must be unique in the chosen Availability Zone. Bucket names must follow the formatbucket_base_name--az-id--x-s3
(for example,DOC-EXAMPLE-BUCKET--usw2-az1--x-s3
). For information about bucket naming restrictions, see Directory bucket naming rules in the Amazon S3 User Guide.Access points - When you use this action with an access point, you must provide the alias of the access point in place of the bucket name or specify the access point ARN. When using the access point ARN, 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.
Note
Access points and Object Lambda access points are not supported by directory buckets.
S3 on Outposts - 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 underCommonPrefixes
result element are not returned elsewhere in the response.Note
Directory buckets - For directory buckets,
/
is the only supported delimiter.EncodingType (string) – Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key can contain any Unicode character; however, the 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) –
Specifies the multipart upload after which listing should begin.
Note
General purpose buckets - For general purpose buckets,
key-marker
is an object key. Together withupload-id-marker
, this parameter specifies the multipart upload after which listing should begin. Ifupload-id-marker
is not specified, only the keys lexicographically greater than the specifiedkey-marker
will be included in the list. Ifupload-id-marker
is specified, any multipart uploads for a key equal to thekey-marker
might also be included, provided those multipart uploads have upload IDs lexicographically greater than the specifiedupload-id-marker
.Directory buckets - For directory buckets,
key-marker
is obfuscated and isn’t a real object key. Theupload-id-marker
parameter isn’t supported by directory buckets. To list the additional multipart uploads, you only need to set the value ofkey-marker
to theNextKeyMarker
value from the previous response. In theListMultipartUploads
response, the multipart uploads aren’t sorted lexicographically based on the object keys.
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 that you’d use a folder in a file system.)Note
Directory buckets - For directory buckets, only prefixes that end in a delimiter (
/
) are supported.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
.Note
This functionality is not supported for directory buckets.
ExpectedBucketOwner (string) – The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code
403 Forbidden
(access denied).RequestPayer (string) –
Confirms that the requester knows that they will be charged for the request. Bucket owners need not specify this parameter in their requests. If either the source or destination S3 bucket has Requester Pays enabled, the requester will pay for corresponding charges to copy the object. For information about downloading objects from Requester Pays buckets, see Downloading Objects in Requester Pays Buckets in the Amazon S3 User Guide.
Note
This functionality is not supported for directory buckets.
- 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'|'SNOW'|'EXPRESS_ONEZONE', 'Owner': { 'DisplayName': 'string', 'ID': 'string' }, 'Initiator': { 'ID': 'string', 'DisplayName': 'string' }, 'ChecksumAlgorithm': 'CRC32'|'CRC32C'|'SHA1'|'SHA256' }, ], 'CommonPrefixes': [ { 'Prefix': 'string' }, ], 'EncodingType': 'url', 'RequestCharged': 'requester' }
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) –
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
.Note
This functionality is not supported for directory buckets.
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.
Note
Directory buckets - For directory buckets, only prefixes that end in a delimiter (
/
) are supported.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.
Note
Directory buckets - For directory buckets,
/
is the only supported delimiter.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.Note
This functionality is not supported for directory buckets.
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.
Note
Directory buckets - Only the S3 Express One Zone storage class is supported by directory buckets to store objects.
Owner (dict) –
Specifies the owner of the object that is part of the multipart upload.
Note
Directory buckets - The bucket owner is returned as the object owner for all the objects.
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)
Note
This functionality is not supported for directory buckets.
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.
Note
Directory buckets - If the principal is an Amazon Web Services account, it provides the Amazon Web Services account ID. If the principal is an IAM User, it provides a user ARN value.
DisplayName (string) –
Name of the Principal.
Note
This functionality is not supported for directory buckets.
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 thePrefix
child element.Note
Directory buckets - For directory buckets, only prefixes that end in a delimiter (
/
) are supported.(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 the
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
.RequestCharged (string) –
If present, indicates that the requester was successfully charged for the request.
Note
This functionality is not supported for directory buckets.
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': { '...': '...', }, }