Skip to content

aws.s3.list_object_versions

Example SQL Queries

SELECT * FROM
aws.s3.list_object_versions
WHERE
"bucket" = 'VALUE';

Description

This operation is not supported by 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.

Table Definition

Column NameColumn Data Type
bucket Required Input Column

The bucket name that contains the objects.

VARCHAR
delimiter Input Column

The delimiter grouping the included keys. A 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.

VARCHAR
encoding_type Input Column

Encoding type used by Amazon S3 to encode object key names in the XML 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:

KeyMarker, NextKeyMarker, Prefix, Key, and Delimiter.

VARCHAR
expected_bucket_owner Input Column

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).

VARCHAR
optional_object_attributes Input Column

Specifies the optional fields that you want returned in the response. Fields that you do not specify are not returned.

VARCHAR[]
Show child fields
optional_object_attributes[]
prefix Input Column

Selects objects that start with the value supplied by this parameter.

VARCHAR
request_payer Input Column

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.

This functionality is not supported for directory buckets.

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

common_prefixes

All of the keys rolled up into a common prefix count as a single return when calculating the number of returns.

STRUCT(
"prefix" VARCHAR
)[]
Show child fields
common_prefixes[]
Show child fields
common_prefixes[].prefix

Container for the specified common prefix.

delete_markers

Container for an object that is a delete marker.

STRUCT(
"owner" STRUCT(
"display_name" VARCHAR,
"id" VARCHAR
),
"key" VARCHAR,
"version_id" VARCHAR,
"is_latest" BOOLEAN,
"last_modified" TIMESTAMP_S
)[]
Show child fields
delete_markers[]
Show child fields
delete_markers[].is_latest

Specifies whether the object is (true) or is not (false) the latest version of an object.

delete_markers[].key

The object key.

delete_markers[].last_modified

Date and time when the object was last modified.

delete_markers[].owner

The account that created the delete marker.>

Show child fields
delete_markers[].owner.display_name

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)

This functionality is not supported for directory buckets.

delete_markers[].owner.id

Container for the ID of the owner.

delete_markers[].version_id

Version ID of an object.

key_marker

Marks the last key returned in a truncated response.

VARCHAR
max_keys

Specifies the maximum number of objects to return.

BIGINT
name

The bucket name.

VARCHAR
request_charged

If present, indicates that the requester was successfully charged for the request.

This functionality is not supported for directory buckets.

VARCHAR
version_id_marker

Marks the last version of the key returned in a truncated response.

VARCHAR
versions

Container for version information.

STRUCT(
"e_tag" VARCHAR,
"checksum_algorithm" VARCHAR[],
"size" BIGINT,
"storage_class" VARCHAR,
"key" VARCHAR,
"version_id" VARCHAR,
"is_latest" BOOLEAN,
"last_modified" TIMESTAMP_S,
"owner" STRUCT(
"display_name" VARCHAR,
"id" VARCHAR
),
"restore_status" STRUCT(
"is_restore_in_progress" BOOLEAN,
"restore_expiry_date" TIMESTAMP_S
)
)[]
Show child fields
versions[]
Show child fields
versions[].checksum_algorithm[]
versions[].e_tag

The entity tag is an MD5 hash of that version of the object.

versions[].is_latest

Specifies whether the object is (true) or is not (false) the latest version of an object.

versions[].key

The object key.

versions[].last_modified

Date and time when the object was last modified.

versions[].owner

Specifies the owner of the object.

Show child fields
versions[].owner.display_name

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)

This functionality is not supported for directory buckets.

versions[].owner.id

Container for the ID of the owner.

versions[].restore_status

Specifies 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.

Show child fields
versions[].restore_status.is_restore_in_progress

Specifies whether the object is currently being restored. If the object restoration is in progress, the header returns the value TRUE. For example:

x-amz-optional-object-attributes: IsRestoreInProgress="true"

If the object restoration has completed, the header returns the value FALSE. For example:

x-amz-optional-object-attributes: IsRestoreInProgress="false", RestoreExpiryDate="2012-12-21T00:00:00.000Z"

If the object hasn't been restored, there is no header response.

versions[].restore_status.restore_expiry_date

Indicates when the restored copy will expire. This value is populated only if the object has already been restored. For example:

x-amz-optional-object-attributes: IsRestoreInProgress="false", RestoreExpiryDate="2012-12-21T00:00:00.000Z"

versions[].size

Size in bytes of the object.

versions[].storage_class

The class of storage used to store the object.

versions[].version_id

Version ID of an object.