Amazon Simple Storage Service

2014/10/16 - Amazon Simple Storage Service - 49 new api methods

ListObjectVersions (new) Link ¶

Returns metadata about all of the versions of objects in a bucket.

Request Syntax

client.list_object_versions(
    Bucket='string',
    Delimiter='string',
    EncodingType='url',
    KeyMarker='string',
    MaxKeys=123,
    Prefix='string',
    VersionIdMarker='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Delimiter

string

param Delimiter

A delimiter is a character you use to group keys.

type EncodingType

string

param EncodingType

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.

type KeyMarker

string

param KeyMarker

Specifies the key to start with when listing objects in a bucket.

type MaxKeys

integer

param MaxKeys

Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more.

type Prefix

string

param Prefix

Limits the response to keys that begin with the specified prefix.

type VersionIdMarker

string

param VersionIdMarker

Specifies the object version you want to start listing from.

rtype

dict

returns

Response Syntax

{
    'IsTruncated': True|False,
    'KeyMarker': 'string',
    'VersionIdMarker': 'string',
    'NextKeyMarker': 'string',
    'NextVersionIdMarker': 'string',
    'Versions': [
        {
            'ETag': 'string',
            'Size': 123,
            'StorageClass': 'STANDARD',
            'Key': 'string',
            'VersionId': 'string',
            'IsLatest': True|False,
            'LastModified': datetime(2015, 1, 1),
            'Owner': {
                'DisplayName': 'string',
                'ID': 'string'
            }
        },
    ],
    'DeleteMarkers': [
        {
            'Owner': {
                'DisplayName': 'string',
                'ID': 'string'
            },
            'Key': 'string',
            'VersionId': 'string',
            'IsLatest': True|False,
            'LastModified': datetime(2015, 1, 1)
        },
    ],
    'Name': 'string',
    'Prefix': 'string',
    'MaxKeys': 123,
    'CommonPrefixes': [
        {
            'Prefix': 'string'
        },
    ],
    'EncodingType': 'url'
}

Response Structure

  • (dict) --

    • IsTruncated (boolean) -- A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria. If your results were truncated, you can make a follow-up paginated request using the NextKeyMarker and NextVersionIdMarker response parameters as a starting place in another request to return the rest of the results.

    • KeyMarker (string) -- Marks the last Key returned in a truncated response.

    • VersionIdMarker (string) --

    • NextKeyMarker (string) -- Use this value for the key marker request parameter in a subsequent request.

    • NextVersionIdMarker (string) -- Use this value for the next version id marker parameter in a subsequent request.

    • Versions (list) --

      • (dict) --

        • ETag (string) --

        • Size (integer) -- Size in bytes of the object.

        • StorageClass (string) -- The class of storage used to store the object.

        • Key (string) -- The object key.

        • VersionId (string) -- Version ID of an object.

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

        • LastModified (datetime) -- Date and time the object was last modified.

        • Owner (dict) --

          • DisplayName (string) --

          • ID (string) --

    • DeleteMarkers (list) --

      • (dict) --

        • Owner (dict) --

          • DisplayName (string) --

          • ID (string) --

        • Key (string) -- The object key.

        • VersionId (string) -- Version ID of an object.

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

        • LastModified (datetime) -- Date and time the object was last modified.

    • Name (string) --

    • Prefix (string) --

    • MaxKeys (integer) --

    • CommonPrefixes (list) --

      • (dict) --

        • Prefix (string) --

    • EncodingType (string) -- Encoding type used by Amazon S3 to encode object keys in the response.

UploadPartCopy (new) Link ¶

Uploads a part by copying data from an existing object as data source.

Request Syntax

client.upload_part_copy(
    Bucket='string',
    CopySource='string',
    CopySourceIfMatch='string',
    CopySourceIfModifiedSince=datetime(2015, 1, 1),
    CopySourceIfNoneMatch='string',
    CopySourceIfUnmodifiedSince=datetime(2015, 1, 1),
    CopySourceRange='string',
    Key='string',
    PartNumber=123,
    UploadId='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',
    SSECustomerKeyMD5='string',
    CopySourceSSECustomerAlgorithm='string',
    CopySourceSSECustomerKey='string',
    CopySourceSSECustomerKeyMD5='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type CopySource

string

param CopySource

[REQUIRED] The name of the source bucket and key name of the source object, separated by a slash (/). Must be URL-encoded.

type CopySourceIfMatch

string

param CopySourceIfMatch

Copies the object if its entity tag (ETag) matches the specified tag.

type CopySourceIfModifiedSince

datetime

param CopySourceIfModifiedSince

Copies the object if it has been modified since the specified time.

type CopySourceIfNoneMatch

string

param CopySourceIfNoneMatch

Copies the object if its entity tag (ETag) is different than the specified ETag.

type CopySourceIfUnmodifiedSince

datetime

param CopySourceIfUnmodifiedSince

Copies the object if it hasn't been modified since the specified time.

type CopySourceRange

string

param CopySourceRange

The range of bytes to copy from the source object. The range value must use the form bytes=first-last, where the first and last are the zero-based byte offsets to copy. For example, bytes=0-9 indicates that you want to copy the first ten bytes of the source. You can copy a range only if the source object is greater than 5 GB.

type Key

string

param Key

[REQUIRED]

type PartNumber

integer

param PartNumber

[REQUIRED] Part number of part being copied.

type UploadId

string

param UploadId

[REQUIRED] Upload ID identifying the multipart upload whose part is being copied.

type SSECustomerAlgorithm

string

param SSECustomerAlgorithm

Specifies the algorithm to use to when encrypting the object (e.g., AES256).

type SSECustomerKey

string

param SSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. This must be the same encryption key specified in the initiate multipart upload request.

type SSECustomerKeyMD5

string

param SSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

type CopySourceSSECustomerAlgorithm

string

param CopySourceSSECustomerAlgorithm

Specifies the algorithm to use when decrypting the source object (e.g., AES256).

type CopySourceSSECustomerKey

string

param CopySourceSSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use to decrypt the source object. The encryption key provided in this header must be one that was used when the source object was created.

type CopySourceSSECustomerKeyMD5

string

param CopySourceSSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

rtype

dict

returns

Response Syntax

{
    'CopySourceVersionId': 'string',
    'CopyPartResult': {
        'ETag': 'string',
        'LastModified': datetime(2015, 1, 1)
    },
    'ServerSideEncryption': 'AES256',
    'SSECustomerAlgorithm': 'string',
    'SSECustomerKeyMD5': 'string'
}

Response Structure

  • (dict) --

    • CopySourceVersionId (string) -- The version of the source object that was copied, if you have enabled versioning on the source bucket.

    • CopyPartResult (dict) --

      • ETag (string) -- Entity tag of the object.

      • LastModified (datetime) -- Date and time at which the object was uploaded.

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.

    • SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.

PutBucketAcl (new) Link ¶

Sets the permissions on a bucket using access control lists (ACL).

Request Syntax

client.put_bucket_acl(
    ACL='private'|'public-read'|'public-read-write'|'authenticated-read',
    AccessControlPolicy={
        'Grants': [
            {
                'Grantee': {
                    'DisplayName': 'string',
                    'EmailAddress': 'string',
                    'ID': 'string',
                    'Type': 'CanonicalUser'|'AmazonCustomerByEmail'|'Group',
                    'URI': 'string'
                },
                'Permission': 'FULL_CONTROL'|'WRITE'|'WRITE_ACP'|'READ'|'READ_ACP'
            },
        ],
        'Owner': {
            'DisplayName': 'string',
            'ID': 'string'
        }
    },
    Bucket='string',
    ContentMD5='string',
    GrantFullControl='string',
    GrantRead='string',
    GrantReadACP='string',
    GrantWrite='string',
    GrantWriteACP='string'
)
type ACL

string

param ACL

The canned ACL to apply to the bucket.

type AccessControlPolicy

dict

param AccessControlPolicy
  • Grants (list) -- A list of grants.

    • (dict) --

      • Grantee (dict) --

        • DisplayName (string) -- Screen name of the grantee.

        • EmailAddress (string) -- Email address of the grantee.

        • ID (string) -- The canonical user ID of the grantee.

        • Type (string) -- [REQUIRED] Type of grantee

        • URI (string) -- URI of the grantee group.

      • Permission (string) -- Specifies the permission given to the grantee.

  • Owner (dict) --

    • DisplayName (string) --

    • ID (string) --

type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type GrantFullControl

string

param GrantFullControl

Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

type GrantRead

string

param GrantRead

Allows grantee to list the objects in the bucket.

type GrantReadACP

string

param GrantReadACP

Allows grantee to read the bucket ACL.

type GrantWrite

string

param GrantWrite

Allows grantee to create, overwrite, and delete any object in the bucket.

type GrantWriteACP

string

param GrantWriteACP

Allows grantee to write the ACL for the applicable bucket.

returns

None

PutBucketCors (new) Link ¶

Sets the cors configuration for a bucket.

Request Syntax

client.put_bucket_cors(
    Bucket='string',
    CORSConfiguration={
        'CORSRules': [
            {
                'AllowedHeaders': [
                    'string',
                ],
                'AllowedMethods': [
                    'string',
                ],
                'AllowedOrigins': [
                    'string',
                ],
                'ExposeHeaders': [
                    'string',
                ],
                'MaxAgeSeconds': 123
            },
        ]
    },
    ContentMD5='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type CORSConfiguration

dict

param CORSConfiguration
  • CORSRules (list) --

    • (dict) --

      • AllowedHeaders (list) -- Specifies which headers are allowed in a pre-flight OPTIONS request.

        • (string) --

      • AllowedMethods (list) -- Identifies HTTP methods that the domain/origin specified in the rule is allowed to execute.

        • (string) --

      • AllowedOrigins (list) -- One or more origins you want customers to be able to access the bucket from.

        • (string) --

      • ExposeHeaders (list) -- One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object).

        • (string) --

      • MaxAgeSeconds (integer) -- The time in seconds that your browser is to cache the preflight response for the specified resource.

type ContentMD5

string

param ContentMD5

returns

None

GetBucketVersioning (new) Link ¶

Returns the versioning state of a bucket.

Request Syntax

client.get_bucket_versioning(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'Status': 'Enabled'|'Suspended',
    'MFADelete': 'Enabled'|'Disabled'
}

Response Structure

  • (dict) --

    • Status (string) -- The versioning state of the bucket.

    • MFADelete (string) -- Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with MFA delete. If the bucket has never been so configured, this element is not returned.

GetObject (new) Link ¶

Retrieves objects from Amazon S3.

Request Syntax

client.get_object(
    Bucket='string',
    IfMatch='string',
    IfModifiedSince=datetime(2015, 1, 1),
    IfNoneMatch='string',
    IfUnmodifiedSince=datetime(2015, 1, 1),
    Key='string',
    Range='string',
    ResponseCacheControl='string',
    ResponseContentDisposition='string',
    ResponseContentEncoding='string',
    ResponseContentLanguage='string',
    ResponseContentType='string',
    ResponseExpires=datetime(2015, 1, 1),
    VersionId='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',
    SSECustomerKeyMD5='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type IfMatch

string

param IfMatch

Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).

type IfModifiedSince

datetime

param IfModifiedSince

Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).

type IfNoneMatch

string

param IfNoneMatch

Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).

type IfUnmodifiedSince

datetime

param IfUnmodifiedSince

Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).

type Key

string

param Key

[REQUIRED]

type Range

string

param Range

Downloads the specified range bytes of an object. For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.

type ResponseCacheControl

string

param ResponseCacheControl

Sets the Cache-Control header of the response.

type ResponseContentDisposition

string

param ResponseContentDisposition

Sets the Content-Disposition header of the response

type ResponseContentEncoding

string

param ResponseContentEncoding

Sets the Content-Encoding header of the response.

type ResponseContentLanguage

string

param ResponseContentLanguage

Sets the Content-Language header of the response.

type ResponseContentType

string

param ResponseContentType

Sets the Content-Type header of the response.

type ResponseExpires

datetime

param ResponseExpires

Sets the Expires header of the response.

type VersionId

string

param VersionId

VersionId used to reference a specific version of the object.

type SSECustomerAlgorithm

string

param SSECustomerAlgorithm

Specifies the algorithm to use to when encrypting the object (e.g., AES256).

type SSECustomerKey

string

param SSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header.

type SSECustomerKeyMD5

string

param SSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

rtype

dict

returns

Response Syntax

{
    'Body': StreamingBody(),
    'DeleteMarker': True|False,
    'AcceptRanges': 'string',
    'Expiration': datetime(2015, 1, 1),
    'Restore': 'string',
    'LastModified': datetime(2015, 1, 1),
    'ContentLength': 123,
    'ETag': 'string',
    'MissingMeta': 123,
    'VersionId': 'string',
    'CacheControl': 'string',
    'ContentDisposition': 'string',
    'ContentEncoding': 'string',
    'ContentLanguage': 'string',
    'ContentType': 'string',
    'Expires': datetime(2015, 1, 1),
    'WebsiteRedirectLocation': 'string',
    'ServerSideEncryption': 'AES256',
    'Metadata': {
        'string': 'string'
    },
    'SSECustomerAlgorithm': 'string',
    'SSECustomerKeyMD5': 'string'
}

Response Structure

  • (dict) --

    • Body (:class:`.StreamingBody`) -- Object data.

    • DeleteMarker (boolean) -- Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response.

    • AcceptRanges (string) --

    • Expiration (datetime) -- If the object expiration is configured (see PUT Bucket lifecycle), the response includes this header. It includes the expiry-date and rule-id key value pairs providing object expiration information. The value of the rule-id is URL encoded.

    • Restore (string) -- Provides information about object restoration operation and expiration time of the restored object copy.

    • LastModified (datetime) -- Last modified date of the object

    • ContentLength (integer) -- Size of the body in bytes.

    • ETag (string) -- An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL

    • MissingMeta (integer) -- This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers.

    • VersionId (string) -- Version of the object.

    • CacheControl (string) -- Specifies caching behavior along the request/reply chain.

    • ContentDisposition (string) -- Specifies presentational information for the object.

    • ContentEncoding (string) -- Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.

    • ContentLanguage (string) -- The language the content is in.

    • ContentType (string) -- A standard MIME type describing the format of the object data.

    • Expires (datetime) -- The date and time at which the object is no longer cacheable.

    • WebsiteRedirectLocation (string) -- If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • Metadata (dict) -- A map of metadata to store with the object in S3.

      • (string) --

        • (string) --

    • SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.

    • SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.

PutBucketLifecycle (new) Link ¶

Sets lifecycle configuration for your bucket. If a lifecycle configuration exists, it replaces it.

Request Syntax

client.put_bucket_lifecycle(
    Bucket='string',
    ContentMD5='string',
    LifecycleConfiguration={
        'Rules': [
            {
                'Expiration': {
                    'Date': datetime(2015, 1, 1),
                    'Days': 123
                },
                'ID': 'string',
                'Prefix': 'string',
                'Status': 'Enabled'|'Disabled',
                'Transition': {
                    'Date': datetime(2015, 1, 1),
                    'Days': 123,
                    'StorageClass': 'GLACIER'
                },
                'NoncurrentVersionTransition': {
                    'NoncurrentDays': 123,
                    'StorageClass': 'GLACIER'
                },
                'NoncurrentVersionExpiration': {
                    'NoncurrentDays': 123
                }
            },
        ]
    }
)
type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type LifecycleConfiguration

dict

param LifecycleConfiguration
  • Rules (list) -- [REQUIRED]

    • (dict) --

      • Expiration (dict) --

        • Date (datetime) -- Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.

        • Days (integer) -- Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

      • ID (string) -- Unique identifier for the rule. The value cannot be longer than 255 characters.

      • Prefix (string) -- [REQUIRED] Prefix identifying one or more objects to which the rule applies.

      • Status (string) -- [REQUIRED] If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied.

      • Transition (dict) --

        • Date (datetime) -- Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.

        • Days (integer) -- Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

        • StorageClass (string) -- The class of storage used to store the object.

      • NoncurrentVersionTransition (dict) -- Container for the transition rule that describes when noncurrent objects transition to the GLACIER storage class. If your bucket is versioning-enabled (or versioning is suspended), you can set this action to request that Amazon S3 transition noncurrent object versions to the GLACIER storage class at a specific period in the object's lifetime.

        • NoncurrentDays (integer) -- Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action. For information about the noncurrent days calculations, see How Amazon S3 Calculates When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide.

        • StorageClass (string) -- The class of storage used to store the object.

      • NoncurrentVersionExpiration (dict) -- Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 permanently deletes the noncurrent object versions. You set this lifecycle configuration action on a bucket that has versioning enabled (or suspended) to request that Amazon S3 delete noncurrent object versions at a specific period in the object's lifetime.

        • NoncurrentDays (integer) -- Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action. For information about the noncurrent days calculations, see How Amazon S3 Calculates When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide.

returns

None

GetObjectTorrent (new) Link ¶

Return torrent files from a bucket.

Request Syntax

client.get_object_torrent(
    Bucket='string',
    Key='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Key

string

param Key

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'Body': StreamingBody()
}

Response Structure

PutObject (new) Link ¶

Adds an object to a bucket.

Request Syntax

client.put_object(
    ACL='private'|'public-read'|'public-read-write'|'authenticated-read'|'bucket-owner-read'|'bucket-owner-full-control',
    Body=b'bytes'|file,
    Bucket='string',
    CacheControl='string',
    ContentDisposition='string',
    ContentEncoding='string',
    ContentLanguage='string',
    ContentLength=123,
    ContentMD5='string',
    ContentType='string',
    Expires=datetime(2015, 1, 1),
    GrantFullControl='string',
    GrantRead='string',
    GrantReadACP='string',
    GrantWriteACP='string',
    Key='string',
    Metadata={
        'string': 'string'
    },
    ServerSideEncryption='AES256',
    StorageClass='STANDARD'|'REDUCED_REDUNDANCY',
    WebsiteRedirectLocation='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',
    SSECustomerKeyMD5='string'
)
type ACL

string

param ACL

The canned ACL to apply to the object.

type Body

bytes or seekable file-like object

param Body

type Bucket

string

param Bucket

[REQUIRED]

type CacheControl

string

param CacheControl

Specifies caching behavior along the request/reply chain.

type ContentDisposition

string

param ContentDisposition

Specifies presentational information for the object.

type ContentEncoding

string

param ContentEncoding

Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.

type ContentLanguage

string

param ContentLanguage

The language the content is in.

type ContentLength

integer

param ContentLength

Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically.

type ContentMD5

string

param ContentMD5

type ContentType

string

param ContentType

A standard MIME type describing the format of the object data.

type Expires

datetime

param Expires

The date and time at which the object is no longer cacheable.

type GrantFullControl

string

param GrantFullControl

Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.

type GrantRead

string

param GrantRead

Allows grantee to read the object data and its metadata.

type GrantReadACP

string

param GrantReadACP

Allows grantee to read the object ACL.

type GrantWriteACP

string

param GrantWriteACP

Allows grantee to write the ACL for the applicable object.

type Key

string

param Key

[REQUIRED]

type Metadata

dict

param Metadata

A map of metadata to store with the object in S3.

  • (string) --

    • (string) --

type ServerSideEncryption

string

param ServerSideEncryption

The Server-side encryption algorithm used when storing this object in S3.

type StorageClass

string

param StorageClass

The type of storage to use for the object. Defaults to 'STANDARD'.

type WebsiteRedirectLocation

string

param WebsiteRedirectLocation

If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.

type SSECustomerAlgorithm

string

param SSECustomerAlgorithm

Specifies the algorithm to use to when encrypting the object (e.g., AES256).

type SSECustomerKey

string

param SSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header.

type SSECustomerKeyMD5

string

param SSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

rtype

dict

returns

Response Syntax

{
    'Expiration': datetime(2015, 1, 1),
    'ETag': 'string',
    'ServerSideEncryption': 'AES256',
    'VersionId': 'string',
    'SSECustomerAlgorithm': 'string',
    'SSECustomerKeyMD5': 'string'
}

Response Structure

  • (dict) --

    • Expiration (datetime) -- If the object expiration is configured, this will contain the expiration date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded.

    • ETag (string) -- Entity tag for the uploaded object.

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • VersionId (string) -- Version of the object.

    • SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.

    • SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.

RestoreObject (new) Link ¶

Restores an archived copy of an object back into Amazon S3

Request Syntax

client.restore_object(
    Bucket='string',
    Key='string',
    VersionId='string',
    RestoreRequest={
        'Days': 123
    }
)
type Bucket

string

param Bucket

[REQUIRED]

type Key

string

param Key

[REQUIRED]

type VersionId

string

param VersionId

type RestoreRequest

dict

param RestoreRequest
  • Days (integer) -- [REQUIRED] Lifetime of the active copy in days

returns

None

PutBucketLogging (new) Link ¶

Set the logging parameters for a bucket and to specify permissions for who can view and modify the logging parameters. To set the logging status of a bucket, you must be the bucket owner.

Request Syntax

client.put_bucket_logging(
    Bucket='string',
    BucketLoggingStatus={
        'LoggingEnabled': {
            'TargetBucket': 'string',
            'TargetGrants': [
                {
                    'Grantee': {
                        'DisplayName': 'string',
                        'EmailAddress': 'string',
                        'ID': 'string',
                        'Type': 'CanonicalUser'|'AmazonCustomerByEmail'|'Group',
                        'URI': 'string'
                    },
                    'Permission': 'FULL_CONTROL'|'READ'|'WRITE'
                },
            ],
            'TargetPrefix': 'string'
        }
    },
    ContentMD5='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type BucketLoggingStatus

dict

param BucketLoggingStatus

[REQUIRED]

  • LoggingEnabled (dict) --

    • TargetBucket (string) -- Specifies the bucket where you want Amazon S3 to store server access logs. You can have your logs delivered to any bucket that you own, including the same bucket that is being logged. You can also configure multiple buckets to deliver their logs to the same target bucket. In this case you should choose a different TargetPrefix for each source bucket so that the delivered log files can be distinguished by key.

    • TargetGrants (list) --

      • (dict) --

        • Grantee (dict) --

          • DisplayName (string) -- Screen name of the grantee.

          • EmailAddress (string) -- Email address of the grantee.

          • ID (string) -- The canonical user ID of the grantee.

          • Type (string) -- [REQUIRED] Type of grantee

          • URI (string) -- URI of the grantee group.

        • Permission (string) -- Logging permissions assigned to the Grantee for the bucket.

    • TargetPrefix (string) -- This element lets you specify a prefix for the keys that the log files will be stored under.

type ContentMD5

string

param ContentMD5

returns

None

PutBucketVersioning (new) Link ¶

Sets the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.

Request Syntax

client.put_bucket_versioning(
    Bucket='string',
    ContentMD5='string',
    MFA='string',
    VersioningConfiguration={
        'MFADelete': 'Enabled'|'Disabled',
        'Status': 'Enabled'|'Suspended'
    }
)
type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type MFA

string

param MFA

The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.

type VersioningConfiguration

dict

param VersioningConfiguration

[REQUIRED]

  • MFADelete (string) -- Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with MFA delete. If the bucket has never been so configured, this element is not returned.

  • Status (string) -- The versioning state of the bucket.

returns

None

GetBucketTagging (new) Link ¶

Returns the tag set associated with the bucket.

Request Syntax

client.get_bucket_tagging(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'TagSet': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • TagSet (list) --

      • (dict) --

        • Key (string) -- Name of the tag.

        • Value (string) -- Value of the tag.

CreateMultipartUpload (new) Link ¶

Initiates a multipart upload and returns an upload ID.

Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.

Request Syntax

client.create_multipart_upload(
    ACL='private'|'public-read'|'public-read-write'|'authenticated-read'|'bucket-owner-read'|'bucket-owner-full-control',
    Bucket='string',
    CacheControl='string',
    ContentDisposition='string',
    ContentEncoding='string',
    ContentLanguage='string',
    ContentType='string',
    Expires=datetime(2015, 1, 1),
    GrantFullControl='string',
    GrantRead='string',
    GrantReadACP='string',
    GrantWriteACP='string',
    Key='string',
    Metadata={
        'string': 'string'
    },
    ServerSideEncryption='AES256',
    StorageClass='STANDARD'|'REDUCED_REDUNDANCY',
    WebsiteRedirectLocation='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',
    SSECustomerKeyMD5='string'
)
type ACL

string

param ACL

The canned ACL to apply to the object.

type Bucket

string

param Bucket

[REQUIRED]

type CacheControl

string

param CacheControl

Specifies caching behavior along the request/reply chain.

type ContentDisposition

string

param ContentDisposition

Specifies presentational information for the object.

type ContentEncoding

string

param ContentEncoding

Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.

type ContentLanguage

string

param ContentLanguage

The language the content is in.

type ContentType

string

param ContentType

A standard MIME type describing the format of the object data.

type Expires

datetime

param Expires

The date and time at which the object is no longer cacheable.

type GrantFullControl

string

param GrantFullControl

Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.

type GrantRead

string

param GrantRead

Allows grantee to read the object data and its metadata.

type GrantReadACP

string

param GrantReadACP

Allows grantee to read the object ACL.

type GrantWriteACP

string

param GrantWriteACP

Allows grantee to write the ACL for the applicable object.

type Key

string

param Key

[REQUIRED]

type Metadata

dict

param Metadata

A map of metadata to store with the object in S3.

  • (string) --

    • (string) --

type ServerSideEncryption

string

param ServerSideEncryption

The Server-side encryption algorithm used when storing this object in S3.

type StorageClass

string

param StorageClass

The type of storage to use for the object. Defaults to 'STANDARD'.

type WebsiteRedirectLocation

string

param WebsiteRedirectLocation

If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.

type SSECustomerAlgorithm

string

param SSECustomerAlgorithm

Specifies the algorithm to use to when encrypting the object (e.g., AES256).

type SSECustomerKey

string

param SSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header.

type SSECustomerKeyMD5

string

param SSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

rtype

dict

returns

Response Syntax

{
    'Bucket': 'string',
    'Key': 'string',
    'UploadId': 'string',
    'ServerSideEncryption': 'AES256',
    'SSECustomerAlgorithm': 'string',
    'SSECustomerKeyMD5': 'string'
}

Response Structure

  • (dict) --

    • Bucket (string) -- Name of the bucket to which the multipart upload was initiated.

    • Key (string) -- Object key for which the multipart upload was initiated.

    • UploadId (string) -- ID for the initiated multipart upload.

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.

    • SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.

DeleteBucket (new) Link ¶

Deletes the bucket. All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted.

Request Syntax

client.delete_bucket(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

returns

None

UploadPart (new) Link ¶

Uploads a part in a multipart upload.

Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage.

Request Syntax

client.upload_part(
    Body=b'bytes'|file,
    Bucket='string',
    ContentLength=123,
    ContentMD5='string',
    Key='string',
    PartNumber=123,
    UploadId='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',
    SSECustomerKeyMD5='string'
)
type Body

bytes or seekable file-like object

param Body

type Bucket

string

param Bucket

[REQUIRED]

type ContentLength

integer

param ContentLength

Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically.

type ContentMD5

string

param ContentMD5

type Key

string

param Key

[REQUIRED]

type PartNumber

integer

param PartNumber

[REQUIRED] Part number of part being uploaded.

type UploadId

string

param UploadId

[REQUIRED] Upload ID identifying the multipart upload whose part is being uploaded.

type SSECustomerAlgorithm

string

param SSECustomerAlgorithm

Specifies the algorithm to use to when encrypting the object (e.g., AES256).

type SSECustomerKey

string

param SSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. This must be the same encryption key specified in the initiate multipart upload request.

type SSECustomerKeyMD5

string

param SSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

rtype

dict

returns

Response Syntax

{
    'ServerSideEncryption': 'AES256',
    'ETag': 'string',
    'SSECustomerAlgorithm': 'string',
    'SSECustomerKeyMD5': 'string'
}

Response Structure

  • (dict) --

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • ETag (string) -- Entity tag for the uploaded object.

    • SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.

    • SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.

DeleteBucketLifecycle (new) Link ¶

Deletes the lifecycle configuration from the bucket.

Request Syntax

client.delete_bucket_lifecycle(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

returns

None

GetBucketAcl (new) Link ¶

Gets the access control policy for the bucket.

Request Syntax

client.get_bucket_acl(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'Owner': {
        'DisplayName': 'string',
        'ID': 'string'
    },
    'Grants': [
        {
            'Grantee': {
                'DisplayName': 'string',
                'EmailAddress': 'string',
                'ID': 'string',
                'Type': 'CanonicalUser'|'AmazonCustomerByEmail'|'Group',
                'URI': 'string'
            },
            'Permission': 'FULL_CONTROL'|'WRITE'|'WRITE_ACP'|'READ'|'READ_ACP'
        },
    ]
}

Response Structure

  • (dict) --

    • Owner (dict) --

      • DisplayName (string) --

      • ID (string) --

    • Grants (list) -- A list of grants.

      • (dict) --

        • Grantee (dict) --

          • DisplayName (string) -- Screen name of the grantee.

          • EmailAddress (string) -- Email address of the grantee.

          • ID (string) -- The canonical user ID of the grantee.

          • Type (string) -- Type of grantee

          • URI (string) -- URI of the grantee group.

        • Permission (string) -- Specifies the permission given to the grantee.

GetBucketNotification (new) Link ¶

Return the notification configuration of a bucket.

Request Syntax

client.get_bucket_notification(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'TopicConfiguration': {
        'Event': 's3:ReducedRedundancyLostObject',
        'Topic': 'string'
    }
}

Response Structure

  • (dict) --

    • TopicConfiguration (dict) --

      • Event (string) -- Bucket event for which to send notifications.

      • Topic (string) -- Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the bucket.

DeleteObjects (new) Link ¶

This operation enables you to delete multiple objects from a bucket using a single HTTP request. You may specify up to 1000 keys.

Request Syntax

client.delete_objects(
    Bucket='string',
    Delete={
        'Objects': [
            {
                'Key': 'string',
                'VersionId': 'string'
            },
        ],
        'Quiet': True|False
    },
    MFA='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Delete

dict

param Delete

[REQUIRED]

  • Objects (list) -- [REQUIRED]

    • (dict) --

      • Key (string) -- [REQUIRED] Key name of the object to delete.

      • VersionId (string) -- VersionId for the specific version of the object to delete.

  • Quiet (boolean) -- Element to enable quiet mode for the request. When you add this element, you must set its value to true.

type MFA

string

param MFA

The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.

rtype

dict

returns

Response Syntax

{
    'Deleted': [
        {
            'Key': 'string',
            'VersionId': 'string',
            'DeleteMarker': True|False,
            'DeleteMarkerVersionId': 'string'
        },
    ],
    'Errors': [
        {
            'Key': 'string',
            'VersionId': 'string',
            'Code': 'string',
            'Message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Deleted (list) --

      • (dict) --

        • Key (string) --

        • VersionId (string) --

        • DeleteMarker (boolean) --

        • DeleteMarkerVersionId (string) --

    • Errors (list) --

      • (dict) --

        • Key (string) --

        • VersionId (string) --

        • Code (string) --

        • Message (string) --

ListMultipartUploads (new) Link ¶

This operation lists in-progress multipart uploads.

Request Syntax

client.list_multipart_uploads(
    Bucket='string',
    Delimiter='string',
    EncodingType='url',
    KeyMarker='string',
    MaxUploads=123,
    Prefix='string',
    UploadIdMarker='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Delimiter

string

param Delimiter

Character you use to group keys.

type EncodingType

string

param EncodingType

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.

type KeyMarker

string

param KeyMarker

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

type MaxUploads

integer

param MaxUploads

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.

type Prefix

string

param Prefix

Lists in-progress uploads only for those keys that begin with the specified prefix.

type UploadIdMarker

string

param UploadIdMarker

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.

rtype

dict

returns

Response Syntax

{
    'Bucket': 'string',
    'KeyMarker': 'string',
    'UploadIdMarker': 'string',
    'NextKeyMarker': 'string',
    'Prefix': 'string',
    'NextUploadIdMarker': 'string',
    'MaxUploads': 123,
    'IsTruncated': True|False,
    'Uploads': [
        {
            'UploadId': 'string',
            'Key': 'string',
            'Initiated': datetime(2015, 1, 1),
            'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY',
            'Owner': {
                'DisplayName': 'string',
                'ID': 'string'
            },
            'Initiator': {
                'ID': 'string',
                'DisplayName': 'string'
            }
        },
    ],
    'CommonPrefixes': [
        {
            'Prefix': 'string'
        },
    ],
    'EncodingType': 'url'
}

Response Structure

  • (dict) --

    • Bucket (string) -- Name of the bucket to which the multipart upload was initiated.

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

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

      • (dict) --

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

          • DisplayName (string) --

          • ID (string) --

        • Initiator (dict) -- Identifies who initiated the multipart upload.

          • ID (string) -- If the principal is an AWS 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.

    • CommonPrefixes (list) --

      • (dict) --

        • Prefix (string) --

    • EncodingType (string) -- Encoding type used by Amazon S3 to encode object keys in the response.

PutBucketWebsite (new) Link ¶

Set the website configuration for a bucket.

Request Syntax

client.put_bucket_website(
    Bucket='string',
    ContentMD5='string',
    WebsiteConfiguration={
        'ErrorDocument': {
            'Key': 'string'
        },
        'IndexDocument': {
            'Suffix': 'string'
        },
        'RedirectAllRequestsTo': {
            'HostName': 'string',
            'Protocol': 'http'|'https'
        },
        'RoutingRules': [
            {
                'Condition': {
                    'HttpErrorCodeReturnedEquals': 'string',
                    'KeyPrefixEquals': 'string'
                },
                'Redirect': {
                    'HostName': 'string',
                    'HttpRedirectCode': 'string',
                    'Protocol': 'http'|'https',
                    'ReplaceKeyPrefixWith': 'string',
                    'ReplaceKeyWith': 'string'
                }
            },
        ]
    }
)
type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type WebsiteConfiguration

dict

param WebsiteConfiguration

[REQUIRED]

  • ErrorDocument (dict) --

    • Key (string) -- [REQUIRED] The object key name to use when a 4XX class error occurs.

  • IndexDocument (dict) --

    • Suffix (string) -- [REQUIRED] A suffix that is appended to a request that is for a directory on the website endpoint (e.g. if the suffix is index.html and you make a request to samplebucket/images/ the data that is returned will be for the object with the key name images/index.html) The suffix must not be empty and must not include a slash character.

  • RedirectAllRequestsTo (dict) --

    • HostName (string) -- [REQUIRED] Name of the host where requests will be redirected.

    • Protocol (string) -- Protocol to use (http, https) when redirecting requests. The default is the protocol that is used in the original request.

  • RoutingRules (list) --

    • (dict) --

      • Condition (dict) -- A container for describing a condition that must be met for the specified redirect to apply. For example, 1. If request is for pages in the /docs folder, redirect to the /documents folder. 2. If request results in HTTP error 4xx, redirect request to another host where you might process the error.

        • HttpErrorCodeReturnedEquals (string) -- The HTTP error code when the redirect is applied. In the event of an error, if the error code equals this value, then the specified redirect is applied. Required when parent element Condition is specified and sibling KeyPrefixEquals is not specified. If both are specified, then both must be true for the redirect to be applied.

        • KeyPrefixEquals (string) -- The object key name prefix when the redirect is applied. For example, to redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. To redirect request for all pages with the prefix docs/, the key prefix will be /docs, which identifies all objects in the docs/ folder. Required when the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals is not specified. If both conditions are specified, both must be true for the redirect to be applied.

      • Redirect (dict) -- [REQUIRED] Container for redirect information. You can redirect requests to another host, to another page, or with another protocol. In the event of an error, you can can specify a different error code to return.

        • HostName (string) -- The host name to use in the redirect request.

        • HttpRedirectCode (string) -- The HTTP redirect code to use on the response. Not required if one of the siblings is present.

        • Protocol (string) -- Protocol to use (http, https) when redirecting requests. The default is the protocol that is used in the original request.

        • ReplaceKeyPrefixWith (string) -- The object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with KeyPrefixEquals set to docs/ and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required if one of the siblings is present. Can be present only if ReplaceKeyWith is not provided.

        • ReplaceKeyWith (string) -- The specific object key to use in the redirect request. For example, redirect request to error.html. Not required if one of the sibling is present. Can be present only if ReplaceKeyPrefixWith is not provided.

returns

None

PutObjectAcl (new) Link ¶

uses the acl subresource to set the access control list (ACL) permissions for an object that already exists in a bucket

Request Syntax

client.put_object_acl(
    ACL='private'|'public-read'|'public-read-write'|'authenticated-read'|'bucket-owner-read'|'bucket-owner-full-control',
    AccessControlPolicy={
        'Grants': [
            {
                'Grantee': {
                    'DisplayName': 'string',
                    'EmailAddress': 'string',
                    'ID': 'string',
                    'Type': 'CanonicalUser'|'AmazonCustomerByEmail'|'Group',
                    'URI': 'string'
                },
                'Permission': 'FULL_CONTROL'|'WRITE'|'WRITE_ACP'|'READ'|'READ_ACP'
            },
        ],
        'Owner': {
            'DisplayName': 'string',
            'ID': 'string'
        }
    },
    Bucket='string',
    ContentMD5='string',
    GrantFullControl='string',
    GrantRead='string',
    GrantReadACP='string',
    GrantWrite='string',
    GrantWriteACP='string',
    Key='string'
)
type ACL

string

param ACL

The canned ACL to apply to the object.

type AccessControlPolicy

dict

param AccessControlPolicy
  • Grants (list) -- A list of grants.

    • (dict) --

      • Grantee (dict) --

        • DisplayName (string) -- Screen name of the grantee.

        • EmailAddress (string) -- Email address of the grantee.

        • ID (string) -- The canonical user ID of the grantee.

        • Type (string) -- [REQUIRED] Type of grantee

        • URI (string) -- URI of the grantee group.

      • Permission (string) -- Specifies the permission given to the grantee.

  • Owner (dict) --

    • DisplayName (string) --

    • ID (string) --

type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type GrantFullControl

string

param GrantFullControl

Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

type GrantRead

string

param GrantRead

Allows grantee to list the objects in the bucket.

type GrantReadACP

string

param GrantReadACP

Allows grantee to read the bucket ACL.

type GrantWrite

string

param GrantWrite

Allows grantee to create, overwrite, and delete any object in the bucket.

type GrantWriteACP

string

param GrantWriteACP

Allows grantee to write the ACL for the applicable bucket.

type Key

string

param Key

[REQUIRED]

returns

None

GetBucketLogging (new) Link ¶

Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the bucket owner.

Request Syntax

client.get_bucket_logging(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'LoggingEnabled': {
        'TargetBucket': 'string',
        'TargetGrants': [
            {
                'Grantee': {
                    'DisplayName': 'string',
                    'EmailAddress': 'string',
                    'ID': 'string',
                    'Type': 'CanonicalUser'|'AmazonCustomerByEmail'|'Group',
                    'URI': 'string'
                },
                'Permission': 'FULL_CONTROL'|'READ'|'WRITE'
            },
        ],
        'TargetPrefix': 'string'
    }
}

Response Structure

  • (dict) --

    • LoggingEnabled (dict) --

      • TargetBucket (string) -- Specifies the bucket where you want Amazon S3 to store server access logs. You can have your logs delivered to any bucket that you own, including the same bucket that is being logged. You can also configure multiple buckets to deliver their logs to the same target bucket. In this case you should choose a different TargetPrefix for each source bucket so that the delivered log files can be distinguished by key.

      • TargetGrants (list) --

        • (dict) --

          • Grantee (dict) --

            • DisplayName (string) -- Screen name of the grantee.

            • EmailAddress (string) -- Email address of the grantee.

            • ID (string) -- The canonical user ID of the grantee.

            • Type (string) -- Type of grantee

            • URI (string) -- URI of the grantee group.

          • Permission (string) -- Logging permissions assigned to the Grantee for the bucket.

      • TargetPrefix (string) -- This element lets you specify a prefix for the keys that the log files will be stored under.

CopyObject (new) Link ¶

Creates a copy of an object that is already stored in Amazon S3.

Request Syntax

client.copy_object(
    ACL='private'|'public-read'|'public-read-write'|'authenticated-read'|'bucket-owner-read'|'bucket-owner-full-control',
    Bucket='string',
    CacheControl='string',
    ContentDisposition='string',
    ContentEncoding='string',
    ContentLanguage='string',
    ContentType='string',
    CopySource='string',
    CopySourceIfMatch='string',
    CopySourceIfModifiedSince=datetime(2015, 1, 1),
    CopySourceIfNoneMatch='string',
    CopySourceIfUnmodifiedSince=datetime(2015, 1, 1),
    Expires=datetime(2015, 1, 1),
    GrantFullControl='string',
    GrantRead='string',
    GrantReadACP='string',
    GrantWriteACP='string',
    Key='string',
    Metadata={
        'string': 'string'
    },
    MetadataDirective='COPY'|'REPLACE',
    ServerSideEncryption='AES256',
    StorageClass='STANDARD'|'REDUCED_REDUNDANCY',
    WebsiteRedirectLocation='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',
    SSECustomerKeyMD5='string',
    CopySourceSSECustomerAlgorithm='string',
    CopySourceSSECustomerKey='string',
    CopySourceSSECustomerKeyMD5='string'
)
type ACL

string

param ACL

The canned ACL to apply to the object.

type Bucket

string

param Bucket

[REQUIRED]

type CacheControl

string

param CacheControl

Specifies caching behavior along the request/reply chain.

type ContentDisposition

string

param ContentDisposition

Specifies presentational information for the object.

type ContentEncoding

string

param ContentEncoding

Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.

type ContentLanguage

string

param ContentLanguage

The language the content is in.

type ContentType

string

param ContentType

A standard MIME type describing the format of the object data.

type CopySource

string

param CopySource

[REQUIRED] The name of the source bucket and key name of the source object, separated by a slash (/). Must be URL-encoded.

type CopySourceIfMatch

string

param CopySourceIfMatch

Copies the object if its entity tag (ETag) matches the specified tag.

type CopySourceIfModifiedSince

datetime

param CopySourceIfModifiedSince

Copies the object if it has been modified since the specified time.

type CopySourceIfNoneMatch

string

param CopySourceIfNoneMatch

Copies the object if its entity tag (ETag) is different than the specified ETag.

type CopySourceIfUnmodifiedSince

datetime

param CopySourceIfUnmodifiedSince

Copies the object if it hasn't been modified since the specified time.

type Expires

datetime

param Expires

The date and time at which the object is no longer cacheable.

type GrantFullControl

string

param GrantFullControl

Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.

type GrantRead

string

param GrantRead

Allows grantee to read the object data and its metadata.

type GrantReadACP

string

param GrantReadACP

Allows grantee to read the object ACL.

type GrantWriteACP

string

param GrantWriteACP

Allows grantee to write the ACL for the applicable object.

type Key

string

param Key

[REQUIRED]

type Metadata

dict

param Metadata

A map of metadata to store with the object in S3.

  • (string) --

    • (string) --

type MetadataDirective

string

param MetadataDirective

Specifies whether the metadata is copied from the source object or replaced with metadata provided in the request.

type ServerSideEncryption

string

param ServerSideEncryption

The Server-side encryption algorithm used when storing this object in S3.

type StorageClass

string

param StorageClass

The type of storage to use for the object. Defaults to 'STANDARD'.

type WebsiteRedirectLocation

string

param WebsiteRedirectLocation

If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.

type SSECustomerAlgorithm

string

param SSECustomerAlgorithm

Specifies the algorithm to use to when encrypting the object (e.g., AES256).

type SSECustomerKey

string

param SSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header.

type SSECustomerKeyMD5

string

param SSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

type CopySourceSSECustomerAlgorithm

string

param CopySourceSSECustomerAlgorithm

Specifies the algorithm to use when decrypting the source object (e.g., AES256).

type CopySourceSSECustomerKey

string

param CopySourceSSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use to decrypt the source object. The encryption key provided in this header must be one that was used when the source object was created.

type CopySourceSSECustomerKeyMD5

string

param CopySourceSSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

rtype

dict

returns

Response Syntax

{
    'CopyObjectResult': {
        'ETag': 'string',
        'LastModified': datetime(2015, 1, 1)
    },
    'Expiration': datetime(2015, 1, 1),
    'CopySourceVersionId': 'string',
    'ServerSideEncryption': 'AES256',
    'SSECustomerAlgorithm': 'string',
    'SSECustomerKeyMD5': 'string'
}

Response Structure

  • (dict) --

    • CopyObjectResult (dict) --

      • ETag (string) --

      • LastModified (datetime) --

    • Expiration (datetime) -- If the object expiration is configured, the response includes this header.

    • CopySourceVersionId (string) --

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.

    • SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.

CompleteMultipartUpload (new) Link ¶

Completes a multipart upload by assembling previously uploaded parts.

Request Syntax

client.complete_multipart_upload(
    Bucket='string',
    Key='string',
    MultipartUpload={
        'Parts': [
            {
                'ETag': 'string',
                'PartNumber': 123
            },
        ]
    },
    UploadId='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Key

string

param Key

[REQUIRED]

type MultipartUpload

dict

param MultipartUpload
  • Parts (list) --

    • (dict) --

      • ETag (string) -- Entity tag returned when the part was uploaded.

      • PartNumber (integer) -- Part number that identifies the part.

type UploadId

string

param UploadId

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'Location': 'string',
    'Bucket': 'string',
    'Key': 'string',
    'Expiration': datetime(2015, 1, 1),
    'ETag': 'string',
    'ServerSideEncryption': 'AES256',
    'VersionId': 'string'
}

Response Structure

  • (dict) --

    • Location (string) --

    • Bucket (string) --

    • Key (string) --

    • Expiration (datetime) -- If the object expiration is configured, this will contain the expiration date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded.

    • ETag (string) -- Entity tag of the object.

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • VersionId (string) -- Version of the object.

GetBucketRequestPayment (new) Link ¶

Returns the request payment configuration of a bucket.

Request Syntax

client.get_bucket_request_payment(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'Payer': 'Requester'|'BucketOwner'
}

Response Structure

  • (dict) --

    • Payer (string) -- Specifies who pays for the download and request fees.

HeadObject (new) Link ¶

The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object.

Request Syntax

client.head_object(
    Bucket='string',
    IfMatch='string',
    IfModifiedSince=datetime(2015, 1, 1),
    IfNoneMatch='string',
    IfUnmodifiedSince=datetime(2015, 1, 1),
    Key='string',
    Range='string',
    VersionId='string',
    SSECustomerAlgorithm='string',
    SSECustomerKey='string',
    SSECustomerKeyMD5='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type IfMatch

string

param IfMatch

Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).

type IfModifiedSince

datetime

param IfModifiedSince

Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).

type IfNoneMatch

string

param IfNoneMatch

Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).

type IfUnmodifiedSince

datetime

param IfUnmodifiedSince

Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).

type Key

string

param Key

[REQUIRED]

type Range

string

param Range

Downloads the specified range bytes of an object. For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.

type VersionId

string

param VersionId

VersionId used to reference a specific version of the object.

type SSECustomerAlgorithm

string

param SSECustomerAlgorithm

Specifies the algorithm to use to when encrypting the object (e.g., AES256).

type SSECustomerKey

string

param SSECustomerKey

Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header.

type SSECustomerKeyMD5

string

param SSECustomerKeyMD5

Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error.

rtype

dict

returns

Response Syntax

{
    'DeleteMarker': True|False,
    'AcceptRanges': 'string',
    'Expiration': datetime(2015, 1, 1),
    'Restore': 'string',
    'LastModified': datetime(2015, 1, 1),
    'ContentLength': 123,
    'ETag': 'string',
    'MissingMeta': 123,
    'VersionId': 'string',
    'CacheControl': 'string',
    'ContentDisposition': 'string',
    'ContentEncoding': 'string',
    'ContentLanguage': 'string',
    'ContentType': 'string',
    'Expires': datetime(2015, 1, 1),
    'WebsiteRedirectLocation': 'string',
    'ServerSideEncryption': 'AES256',
    'Metadata': {
        'string': 'string'
    },
    'SSECustomerAlgorithm': 'string',
    'SSECustomerKeyMD5': 'string'
}

Response Structure

  • (dict) --

    • DeleteMarker (boolean) -- Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response.

    • AcceptRanges (string) --

    • Expiration (datetime) -- If the object expiration is configured (see PUT Bucket lifecycle), the response includes this header. It includes the expiry-date and rule-id key value pairs providing object expiration information. The value of the rule-id is URL encoded.

    • Restore (string) -- Provides information about object restoration operation and expiration time of the restored object copy.

    • LastModified (datetime) -- Last modified date of the object

    • ContentLength (integer) -- Size of the body in bytes.

    • ETag (string) -- An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL

    • MissingMeta (integer) -- This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers.

    • VersionId (string) -- Version of the object.

    • CacheControl (string) -- Specifies caching behavior along the request/reply chain.

    • ContentDisposition (string) -- Specifies presentational information for the object.

    • ContentEncoding (string) -- Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.

    • ContentLanguage (string) -- The language the content is in.

    • ContentType (string) -- A standard MIME type describing the format of the object data.

    • Expires (datetime) -- The date and time at which the object is no longer cacheable.

    • WebsiteRedirectLocation (string) -- If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.

    • ServerSideEncryption (string) -- The Server-side encryption algorithm used when storing this object in S3.

    • Metadata (dict) -- A map of metadata to store with the object in S3.

      • (string) --

        • (string) --

    • SSECustomerAlgorithm (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used.

    • SSECustomerKeyMD5 (string) -- If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key.

GetBucketLocation (new) Link ¶

Returns the region the bucket resides in.

Request Syntax

client.get_bucket_location(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'LocationConstraint': 'EU'|'eu-west-1'|'us-west-1'|'us-west-2'|'ap-southeast-1'|'ap-southeast-2'|'ap-northeast-1'|'sa-east-1'|''
}

Response Structure

  • (dict) --

    • LocationConstraint (string) --

GetBucketCors (new) Link ¶

Returns the cors configuration for the bucket.

Request Syntax

client.get_bucket_cors(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'CORSRules': [
        {
            'AllowedHeaders': [
                'string',
            ],
            'AllowedMethods': [
                'string',
            ],
            'AllowedOrigins': [
                'string',
            ],
            'ExposeHeaders': [
                'string',
            ],
            'MaxAgeSeconds': 123
        },
    ]
}

Response Structure

  • (dict) --

    • CORSRules (list) --

      • (dict) --

        • AllowedHeaders (list) -- Specifies which headers are allowed in a pre-flight OPTIONS request.

          • (string) --

        • AllowedMethods (list) -- Identifies HTTP methods that the domain/origin specified in the rule is allowed to execute.

          • (string) --

        • AllowedOrigins (list) -- One or more origins you want customers to be able to access the bucket from.

          • (string) --

        • ExposeHeaders (list) -- One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object).

          • (string) --

        • MaxAgeSeconds (integer) -- The time in seconds that your browser is to cache the preflight response for the specified resource.

CreateBucket (new) Link ¶

Creates a new bucket.

Request Syntax

client.create_bucket(
    ACL='private'|'public-read'|'public-read-write'|'authenticated-read',
    Bucket='string',
    CreateBucketConfiguration={
        'LocationConstraint': 'EU'|'eu-west-1'|'us-west-1'|'us-west-2'|'ap-southeast-1'|'ap-southeast-2'|'ap-northeast-1'|'sa-east-1'|''
    },
    GrantFullControl='string',
    GrantRead='string',
    GrantReadACP='string',
    GrantWrite='string',
    GrantWriteACP='string'
)
type ACL

string

param ACL

The canned ACL to apply to the bucket.

type Bucket

string

param Bucket

[REQUIRED]

type CreateBucketConfiguration

dict

param CreateBucketConfiguration
  • LocationConstraint (string) -- Specifies the region where the bucket will be created.

type GrantFullControl

string

param GrantFullControl

Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.

type GrantRead

string

param GrantRead

Allows grantee to list the objects in the bucket.

type GrantReadACP

string

param GrantReadACP

Allows grantee to read the bucket ACL.

type GrantWrite

string

param GrantWrite

Allows grantee to create, overwrite, and delete any object in the bucket.

type GrantWriteACP

string

param GrantWriteACP

Allows grantee to write the ACL for the applicable bucket.

rtype

dict

returns

Response Syntax

{
    'Location': 'string'
}

Response Structure

  • (dict) --

    • Location (string) --

ListParts (new) Link ¶

Lists the parts that have been uploaded for a specific multipart upload.

Request Syntax

client.list_parts(
    Bucket='string',
    Key='string',
    MaxParts=123,
    PartNumberMarker=123,
    UploadId='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Key

string

param Key

[REQUIRED]

type MaxParts

integer

param MaxParts

Sets the maximum number of parts to return.

type PartNumberMarker

integer

param PartNumberMarker

Specifies the part after which listing should begin. Only parts with higher part numbers will be listed.

type UploadId

string

param UploadId

[REQUIRED] Upload ID identifying the multipart upload whose parts are being listed.

rtype

dict

returns

Response Syntax

{
    'Bucket': 'string',
    'Key': 'string',
    'UploadId': 'string',
    'PartNumberMarker': 123,
    'NextPartNumberMarker': 123,
    'MaxParts': 123,
    'IsTruncated': True|False,
    'Parts': [
        {
            'PartNumber': 123,
            'LastModified': datetime(2015, 1, 1),
            'ETag': 'string',
            'Size': 123
        },
    ],
    'Initiator': {
        'ID': 'string',
        'DisplayName': 'string'
    },
    'Owner': {
        'DisplayName': 'string',
        'ID': 'string'
    },
    'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'
}

Response Structure

  • (dict) --

    • Bucket (string) -- Name of the bucket to which the multipart upload was initiated.

    • Key (string) -- Object key for which the multipart upload was initiated.

    • UploadId (string) -- Upload ID identifying the multipart upload whose parts are being listed.

    • PartNumberMarker (integer) -- Part number after which listing begins.

    • NextPartNumberMarker (integer) -- When a list is truncated, this element specifies the last part in the list, as well as the value to use for the part-number-marker request parameter in a subsequent request.

    • MaxParts (integer) -- Maximum number of parts that were allowed in the response.

    • IsTruncated (boolean) -- Indicates whether the returned list of parts is truncated.

    • Parts (list) --

      • (dict) --

        • PartNumber (integer) -- Part number identifying the part.

        • LastModified (datetime) -- Date and time at which the part was uploaded.

        • ETag (string) -- Entity tag returned when the part was uploaded.

        • Size (integer) -- Size of the uploaded part data.

    • Initiator (dict) -- Identifies who initiated the multipart upload.

      • ID (string) -- If the principal is an AWS 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.

    • Owner (dict) --

      • DisplayName (string) --

      • ID (string) --

    • StorageClass (string) -- The class of storage used to store the object.

HeadBucket (new) Link ¶

This operation is useful to determine if a bucket exists and you have permission to access it.

Request Syntax

client.head_bucket(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

returns

None

DeleteBucketTagging (new) Link ¶

Deletes the tags from the bucket.

Request Syntax

client.delete_bucket_tagging(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

returns

None

DeleteBucketPolicy (new) Link ¶

Deletes the policy from the bucket.

Request Syntax

client.delete_bucket_policy(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

returns

None

DeleteBucketWebsite (new) Link ¶

This operation removes the website configuration from the bucket.

Request Syntax

client.delete_bucket_website(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

returns

None

GetObjectAcl (new) Link ¶

Returns the access control list (ACL) of an object.

Request Syntax

client.get_object_acl(
    Bucket='string',
    Key='string',
    VersionId='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Key

string

param Key

[REQUIRED]

type VersionId

string

param VersionId

VersionId used to reference a specific version of the object.

rtype

dict

returns

Response Syntax

{
    'Owner': {
        'DisplayName': 'string',
        'ID': 'string'
    },
    'Grants': [
        {
            'Grantee': {
                'DisplayName': 'string',
                'EmailAddress': 'string',
                'ID': 'string',
                'Type': 'CanonicalUser'|'AmazonCustomerByEmail'|'Group',
                'URI': 'string'
            },
            'Permission': 'FULL_CONTROL'|'WRITE'|'WRITE_ACP'|'READ'|'READ_ACP'
        },
    ]
}

Response Structure

  • (dict) --

    • Owner (dict) --

      • DisplayName (string) --

      • ID (string) --

    • Grants (list) -- A list of grants.

      • (dict) --

        • Grantee (dict) --

          • DisplayName (string) -- Screen name of the grantee.

          • EmailAddress (string) -- Email address of the grantee.

          • ID (string) -- The canonical user ID of the grantee.

          • Type (string) -- Type of grantee

          • URI (string) -- URI of the grantee group.

        • Permission (string) -- Specifies the permission given to the grantee.

PutBucketNotification (new) Link ¶

Enables notifications of specified events for a bucket.

Request Syntax

client.put_bucket_notification(
    Bucket='string',
    ContentMD5='string',
    NotificationConfiguration={
        'TopicConfiguration': {
            'Event': 's3:ReducedRedundancyLostObject',
            'Topic': 'string'
        }
    }
)
type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type NotificationConfiguration

dict

param NotificationConfiguration

[REQUIRED]

  • TopicConfiguration (dict) -- [REQUIRED]

    • Event (string) -- Bucket event for which to send notifications.

    • Topic (string) -- Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the bucket.

returns

None

PutBucketRequestPayment (new) Link ¶

Sets the request payment configuration for a bucket. By default, the bucket owner pays for downloads from the bucket. This configuration parameter enables the bucket owner (only) to specify that the person requesting the download will be charged for the download.

Request Syntax

client.put_bucket_request_payment(
    Bucket='string',
    ContentMD5='string',
    RequestPaymentConfiguration={
        'Payer': 'Requester'|'BucketOwner'
    }
)
type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type RequestPaymentConfiguration

dict

param RequestPaymentConfiguration

[REQUIRED]

  • Payer (string) -- [REQUIRED] Specifies who pays for the download and request fees.

returns

None

GetBucketWebsite (new) Link ¶

Returns the website configuration for a bucket.

Request Syntax

client.get_bucket_website(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'RedirectAllRequestsTo': {
        'HostName': 'string',
        'Protocol': 'http'|'https'
    },
    'IndexDocument': {
        'Suffix': 'string'
    },
    'ErrorDocument': {
        'Key': 'string'
    },
    'RoutingRules': [
        {
            'Condition': {
                'HttpErrorCodeReturnedEquals': 'string',
                'KeyPrefixEquals': 'string'
            },
            'Redirect': {
                'HostName': 'string',
                'HttpRedirectCode': 'string',
                'Protocol': 'http'|'https',
                'ReplaceKeyPrefixWith': 'string',
                'ReplaceKeyWith': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) --

    • RedirectAllRequestsTo (dict) --

      • HostName (string) -- Name of the host where requests will be redirected.

      • Protocol (string) -- Protocol to use (http, https) when redirecting requests. The default is the protocol that is used in the original request.

    • IndexDocument (dict) --

      • Suffix (string) -- A suffix that is appended to a request that is for a directory on the website endpoint (e.g. if the suffix is index.html and you make a request to samplebucket/images/ the data that is returned will be for the object with the key name images/index.html) The suffix must not be empty and must not include a slash character.

    • ErrorDocument (dict) --

      • Key (string) -- The object key name to use when a 4XX class error occurs.

    • RoutingRules (list) --

      • (dict) --

        • Condition (dict) -- A container for describing a condition that must be met for the specified redirect to apply. For example, 1. If request is for pages in the /docs folder, redirect to the /documents folder. 2. If request results in HTTP error 4xx, redirect request to another host where you might process the error.

          • HttpErrorCodeReturnedEquals (string) -- The HTTP error code when the redirect is applied. In the event of an error, if the error code equals this value, then the specified redirect is applied. Required when parent element Condition is specified and sibling KeyPrefixEquals is not specified. If both are specified, then both must be true for the redirect to be applied.

          • KeyPrefixEquals (string) -- The object key name prefix when the redirect is applied. For example, to redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. To redirect request for all pages with the prefix docs/, the key prefix will be /docs, which identifies all objects in the docs/ folder. Required when the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals is not specified. If both conditions are specified, both must be true for the redirect to be applied.

        • Redirect (dict) -- Container for redirect information. You can redirect requests to another host, to another page, or with another protocol. In the event of an error, you can can specify a different error code to return.

          • HostName (string) -- The host name to use in the redirect request.

          • HttpRedirectCode (string) -- The HTTP redirect code to use on the response. Not required if one of the siblings is present.

          • Protocol (string) -- Protocol to use (http, https) when redirecting requests. The default is the protocol that is used in the original request.

          • ReplaceKeyPrefixWith (string) -- The object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with KeyPrefixEquals set to docs/ and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required if one of the siblings is present. Can be present only if ReplaceKeyWith is not provided.

          • ReplaceKeyWith (string) -- The specific object key to use in the redirect request. For example, redirect request to error.html. Not required if one of the sibling is present. Can be present only if ReplaceKeyPrefixWith is not provided.

ListObjects (new) Link ¶

Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.

Request Syntax

client.list_objects(
    Bucket='string',
    Delimiter='string',
    EncodingType='url',
    Marker='string',
    MaxKeys=123,
    Prefix='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Delimiter

string

param Delimiter

A delimiter is a character you use to group keys.

type EncodingType

string

param EncodingType

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.

type Marker

string

param Marker

Specifies the key to start with when listing objects in a bucket.

type MaxKeys

integer

param MaxKeys

Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more.

type Prefix

string

param Prefix

Limits the response to keys that begin with the specified prefix.

rtype

dict

returns

Response Syntax

{
    'IsTruncated': True|False,
    'Marker': 'string',
    'NextMarker': 'string',
    'Contents': [
        {
            'Key': 'string',
            'LastModified': datetime(2015, 1, 1),
            'ETag': 'string',
            'Size': 123,
            'StorageClass': 'STANDARD'|'REDUCED_REDUNDANCY'|'GLACIER',
            'Owner': {
                'DisplayName': 'string',
                'ID': 'string'
            }
        },
    ],
    'Name': 'string',
    'Prefix': 'string',
    'MaxKeys': 123,
    'CommonPrefixes': [
        {
            'Prefix': 'string'
        },
    ],
    'EncodingType': 'url'
}

Response Structure

  • (dict) --

    • IsTruncated (boolean) -- A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria.

    • Marker (string) --

    • NextMarker (string) -- When response is truncated (the IsTruncated element value in the response is true), you can use the key name in this field as marker in the subsequent request to get next set of objects. Amazon S3 lists objects in alphabetical order Note: This element is returned only if you have delimiter request parameter specified. If response does not include the NextMaker and it is truncated, you can use the value of the last Key in the response as the marker in the subsequent request to get the next set of object keys.

    • Contents (list) --

      • (dict) --

        • Key (string) --

        • LastModified (datetime) --

        • ETag (string) --

        • Size (integer) --

        • StorageClass (string) -- The class of storage used to store the object.

        • Owner (dict) --

          • DisplayName (string) --

          • ID (string) --

    • Name (string) --

    • Prefix (string) --

    • MaxKeys (integer) --

    • CommonPrefixes (list) --

      • (dict) --

        • Prefix (string) --

    • EncodingType (string) -- Encoding type used by Amazon S3 to encode object keys in the response.

PutBucketTagging (new) Link ¶

Sets the tags for a bucket.

Request Syntax

client.put_bucket_tagging(
    Bucket='string',
    ContentMD5='string',
    Tagging={
        'TagSet': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    }
)
type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type Tagging

dict

param Tagging

[REQUIRED]

  • TagSet (list) -- [REQUIRED]

    • (dict) --

      • Key (string) -- [REQUIRED] Name of the tag.

      • Value (string) -- [REQUIRED] Value of the tag.

returns

None

GetBucketLifecycle (new) Link ¶

Returns the lifecycle configuration information set on the bucket.

Request Syntax

client.get_bucket_lifecycle(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'Rules': [
        {
            'Expiration': {
                'Date': datetime(2015, 1, 1),
                'Days': 123
            },
            'ID': 'string',
            'Prefix': 'string',
            'Status': 'Enabled'|'Disabled',
            'Transition': {
                'Date': datetime(2015, 1, 1),
                'Days': 123,
                'StorageClass': 'GLACIER'
            },
            'NoncurrentVersionTransition': {
                'NoncurrentDays': 123,
                'StorageClass': 'GLACIER'
            },
            'NoncurrentVersionExpiration': {
                'NoncurrentDays': 123
            }
        },
    ]
}

Response Structure

  • (dict) --

    • Rules (list) --

      • (dict) --

        • Expiration (dict) --

          • Date (datetime) -- Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.

          • Days (integer) -- Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

        • ID (string) -- Unique identifier for the rule. The value cannot be longer than 255 characters.

        • Prefix (string) -- Prefix identifying one or more objects to which the rule applies.

        • Status (string) -- If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied.

        • Transition (dict) --

          • Date (datetime) -- Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format.

          • Days (integer) -- Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer.

          • StorageClass (string) -- The class of storage used to store the object.

        • NoncurrentVersionTransition (dict) -- Container for the transition rule that describes when noncurrent objects transition to the GLACIER storage class. If your bucket is versioning-enabled (or versioning is suspended), you can set this action to request that Amazon S3 transition noncurrent object versions to the GLACIER storage class at a specific period in the object's lifetime.

          • NoncurrentDays (integer) -- Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action. For information about the noncurrent days calculations, see How Amazon S3 Calculates When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide.

          • StorageClass (string) -- The class of storage used to store the object.

        • NoncurrentVersionExpiration (dict) -- Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 permanently deletes the noncurrent object versions. You set this lifecycle configuration action on a bucket that has versioning enabled (or suspended) to request that Amazon S3 delete noncurrent object versions at a specific period in the object's lifetime.

          • NoncurrentDays (integer) -- Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action. For information about the noncurrent days calculations, see How Amazon S3 Calculates When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide.

AbortMultipartUpload (new) Link ¶

Aborts a multipart upload.

To verify that all parts have been removed, so you don't get charged for the part storage, you should call the List Parts operation and ensure the parts list is empty.

Request Syntax

client.abort_multipart_upload(
    Bucket='string',
    Key='string',
    UploadId='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Key

string

param Key

[REQUIRED]

type UploadId

string

param UploadId

[REQUIRED]

returns

None

GetBucketPolicy (new) Link ¶

Returns the policy of a specified bucket.

Request Syntax

client.get_bucket_policy(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'Policy': 'string'
}

Response Structure

  • (dict) --

    • Policy (string) -- The bucket policy as a JSON document.

ListBuckets (new) Link ¶

Returns a list of all buckets owned by the authenticated sender of the request.

Request Syntax

client.list_buckets()
rtype

dict

returns

Response Syntax

{
    'Buckets': [
        {
            'Name': 'string',
            'CreationDate': datetime(2015, 1, 1)
        },
    ],
    'Owner': {
        'DisplayName': 'string',
        'ID': 'string'
    }
}

Response Structure

  • (dict) --

    • Buckets (list) --

      • (dict) --

        • Name (string) -- The name of the bucket.

        • CreationDate (datetime) -- Date the bucket was created.

    • Owner (dict) --

      • DisplayName (string) --

      • ID (string) --

DeleteObject (new) Link ¶

Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects.

Request Syntax

client.delete_object(
    Bucket='string',
    Key='string',
    MFA='string',
    VersionId='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type Key

string

param Key

[REQUIRED]

type MFA

string

param MFA

The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.

type VersionId

string

param VersionId

VersionId used to reference a specific version of the object.

rtype

dict

returns

Response Syntax

{
    'DeleteMarker': True|False,
    'VersionId': 'string'
}

Response Structure

  • (dict) --

    • DeleteMarker (boolean) -- Specifies whether the versioned object that was permanently deleted was (true) or was not (false) a delete marker.

    • VersionId (string) -- Returns the version ID of the delete marker created as a result of the DELETE operation.

PutBucketPolicy (new) Link ¶

Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it.

Request Syntax

client.put_bucket_policy(
    Bucket='string',
    ContentMD5='string',
    Policy='string'
)
type Bucket

string

param Bucket

[REQUIRED]

type ContentMD5

string

param ContentMD5

type Policy

string

param Policy

[REQUIRED] The bucket policy as a JSON document.

returns

None

DeleteBucketCors (new) Link ¶

Deletes the cors configuration information set for the bucket.

Request Syntax

client.delete_bucket_cors(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

returns

None