Skip to main content

object_versions

Creates, updates, deletes, gets or lists an object_versions resource.

Overview

Nameobject_versions
TypeResource
Idaws.s3.object_versions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
checksum_algorithmstringThe algorithm that was used to create a checksum of the object.
checksum_typestringThe checksum type that is used to calculate the object’s checksum value. For more information, see Checking object integrity in the Amazon S3 User Guide.
e_tagstringThe entity tag is an MD5 hash of that version of the object.
is_latestbooleanSpecifies whether the object is (true) or is not (false) the latest version of an object.
keystringThe object key.
last_modifiedstringDate and time when the object was last modified.
ownerstringSpecifies the owner of the object.
restore_statusstringSpecifies the restoration status of an object. Objects in certain storage classes must be restored before they can be retrieved. For more information about these storage classes and how to work with archived objects, see Working with archived objects in the Amazon S3 User Guide.
sizeintegerSize in bytes of the object.
storage_classstringThe class of storage used to store the object.
version_idstringVersion ID of an object.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_object_versionsselectbucket, regiondelimiter, encoding-type, key-marker, max-keys, prefix, version-id-marker, x-amz-expected-bucket-owner, x-amz-request-payer, x-amz-optional-object-attributesThis operation is not supported for directory buckets. Returns metadata about all versions of the objects in a bucket. You can also use request parameters as selection criteria to return metadata about a subset of all the object versions. To use this operation, you must have permission to perform the s3:ListBucketVersions action. Be aware of the name difference. A 200 OK response can contain valid or invalid XML. Make sure to design your application to parse the contents of the response and handle it appropriately. To use this operation, you must have READ access to the bucket. The following operations are related to ListObjectVersions: ListObjectsV2 GetObject PutObject DeleteObject You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
bucketstringThe bucket name that contains the objects.
regionstringAWS region (default: us-east-1)
delimiterstringA delimiter is a character that you specify to group keys. All keys that contain the same string between the prefix and the first occurrence of the delimiter are grouped under a single result element in CommonPrefixes. These groups are counted as one result against the max-keys limitation. These keys are not returned elsewhere in the response. CommonPrefixes is filtered out from results if it is not lexicographically greater than the key-marker.
encoding-typestring
key-markerstringSpecifies the key to start with when listing objects in a bucket.
max-keysintegerSets the maximum number of keys returned in the response. By default, the action returns up to 1,000 key names. The response might contain fewer keys but will never contain more. If additional keys satisfy the search criteria, but were not returned because max-keys was exceeded, the response contains <isTruncated>true</isTruncated>. To return the additional keys, see key-marker and version-id-marker.
prefixstringUse this parameter to select only those keys that begin with the specified prefix. You can use prefixes to separate a bucket into different groupings 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.) You can use prefix with delimiter to roll up numerous objects into a single result under CommonPrefixes.
version-id-markerstringSpecifies the object version you want to start listing from.
x-amz-expected-bucket-ownerstringThe 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).
x-amz-optional-object-attributesarraySpecifies the optional fields that you want returned in the response. Fields that you do not specify are not returned.
x-amz-request-payerstring

SELECT examples

This operation is not supported for directory buckets. Returns metadata about all versions of the objects in a bucket. You can also use request parameters as selection criteria to return metadata about a subset of all the object versions. To use this operation, you must have permission to perform the s3:ListBucketVersions action. Be aware of the name difference. A 200 OK response can contain valid or invalid XML. Make sure to design your application to parse the contents of the response and handle it appropriately. To use this operation, you must have READ access to the bucket. The following operations are related to ListObjectVersions: ListObjectsV2 GetObject PutObject DeleteObject You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

SELECT
checksum_algorithm,
checksum_type,
e_tag,
is_latest,
key,
last_modified,
owner,
restore_status,
size,
storage_class,
version_id
FROM aws.s3.object_versions
WHERE bucket = '{{ bucket }}' -- required
AND region = '{{ region }}' -- required
AND delimiter = '{{ delimiter }}'
AND `encoding-type` = '{{ encoding-type }}'
AND `key-marker` = '{{ key-marker }}'
AND `max-keys` = '{{ max-keys }}'
AND prefix = '{{ prefix }}'
AND `version-id-marker` = '{{ version-id-marker }}'
AND `x-amz-expected-bucket-owner` = '{{ x-amz-expected-bucket-owner }}'
AND `x-amz-request-payer` = '{{ x-amz-request-payer }}'
AND `x-amz-optional-object-attributes` = '{{ x-amz-optional-object-attributes }}'
;