Class: AWS.S3

Inherits:
AWS.Service show all
Identifier:
s3
API Version:
2006-03-01
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Sending a Request Using S3

var s3 = new AWS.S3();
s3.getBucketAcl(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the S3 object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var s3 = new AWS.S3({apiVersion: '2006-03-01'});

You can also set the API version globally in AWS.config.apiVersions using the s3 service identifier:

AWS.config.apiVersions = {
  s3: '2006-03-01',
  // other service API versions
};

var s3 = new AWS.S3();

Version:

Property Summary

Properties inherited from AWS.Service

apiVersions

Method Summary (collapse)

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, defineService

Constructor Details

This class inherits a constructor from AWS.Service

Method Details

(AWS.Request) abortMultipartUpload(params = {}, callback)

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.

Examples:

Calling the abortMultipartUpload operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  UploadId: 'STRING_VALUE', // required
};
s3.abortMultipartUpload(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Keyrequired — (String)
    • UploadIdrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) completeMultipartUpload(params = {}, callback)

Completes a multipart upload by assembling previously uploaded parts.

Examples:

Calling the completeMultipartUpload operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  UploadId: 'STRING_VALUE', // required
  MultipartUpload: {
    Parts: [
      {
        ETag: 'STRING_VALUE',
        PartNumber: 0,
      },
      // ... more items ...
    ],
  },
};
s3.completeMultipartUpload(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Keyrequired — (String)
    • MultipartUpload — (map)
      • Parts — (Array<map>)
        • ETag — (String) Entity tag returned when the part was uploaded.
        • PartNumber — (Integer) Part number that identifies the part.
    • UploadIdrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Location — (String)
      • Bucket — (String)
      • Key — (String)
      • Expiration — (Date) 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. Possible values include:
        • "AES256"
      • VersionId — (String) Version of the object.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) copyObject(params = {}, callback)

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

Examples:

Calling the copyObject operation

var params = {
  Bucket: 'STRING_VALUE', // required
  CopySource: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  ACL: 'private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control',
  CacheControl: 'STRING_VALUE',
  ContentDisposition: 'STRING_VALUE',
  ContentEncoding: 'STRING_VALUE',
  ContentLanguage: 'STRING_VALUE',
  ContentType: 'STRING_VALUE',
  CopySourceIfMatch: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  CopySourceIfModifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  CopySourceIfNoneMatch: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  CopySourceIfUnmodifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  Expires: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  GrantFullControl: 'STRING_VALUE',
  GrantRead: 'STRING_VALUE',
  GrantReadACP: 'STRING_VALUE',
  GrantWriteACP: 'STRING_VALUE',
  Metadata: {
    someKey: 'STRING_VALUE',
    // anotherKey: ...
  },
  MetadataDirective: 'COPY | REPLACE',
  ServerSideEncryption: 'AES256',
  StorageClass: 'STANDARD | REDUCED_REDUNDANCY',
  WebsiteRedirectLocation: 'STRING_VALUE',
};
s3.copyObject(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • ACL — (String) The canned ACL to apply to the object. Possible values include:
      • "private"
      • "public-read"
      • "public-read-write"
      • "authenticated-read"
      • "bucket-owner-read"
      • "bucket-owner-full-control"
    • Bucketrequired — (String)
    • 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.
    • CopySourcerequired — (String) The name of the source bucket and key name of the source object, separated by a slash (/). Must be URL-encoded.
    • CopySourceIfMatch — (Date) Copies the object if its entity tag (ETag) matches the specified tag.
    • CopySourceIfModifiedSince — (Date) Copies the object if it has been modified since the specified time.
    • CopySourceIfNoneMatch — (Date) Copies the object if its entity tag (ETag) is different than the specified ETag.
    • CopySourceIfUnmodifiedSince — (Date) Copies the object if it hasn't been modified since the specified time.
    • Expires — (Date) The date and time at which the object is no longer cacheable.
    • GrantFullControl — (String) Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
    • GrantRead — (String) Allows grantee to read the object data and its metadata.
    • GrantReadACP — (String) Allows grantee to read the object ACL.
    • GrantWriteACP — (String) Allows grantee to write the ACL for the applicable object.
    • Keyrequired — (String)
    • Metadata — (map<String>) A map of metadata to store with the object in S3.
    • MetadataDirective — (String) Specifies whether the metadata is copied from the source object or replaced with metadata provided in the request. Possible values include:
      • "COPY"
      • "REPLACE"
    • ServerSideEncryption — (String) The Server-side encryption algorithm used when storing this object in S3. Possible values include:
      • "AES256"
    • StorageClass — (String) The type of storage to use for the object. Defaults to 'STANDARD'. Possible values include:
      • "STANDARD"
      • "REDUCED_REDUNDANCY"
    • 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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Expiration — (Date) 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. Possible values include:
        • "AES256"
      • ETag — (String)
      • LastModified — (Date)

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) createBucket(params, callback)

Creates a new bucket.

Examples:

Calling the createBucket operation

var params = {
  Bucket: 'STRING_VALUE', // required
  ACL: 'private | public-read | public-read-write | authenticated-read',
  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_VALUE',
  GrantRead: 'STRING_VALUE',
  GrantReadACP: 'STRING_VALUE',
  GrantWrite: 'STRING_VALUE',
  GrantWriteACP: 'STRING_VALUE',
};
s3.createBucket(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object)
    • ACL — (String) The canned ACL to apply to the bucket. Possible values include:
      • "private"
      • "public-read"
      • "public-read-write"
      • "authenticated-read"
    • Bucketrequired — (String)
    • CreateBucketConfiguration — (map)
      • LocationConstraint — (String) Specifies the region where the bucket will be created. Possible values include:
        • "EU"
        • "eu-west-1"
        • "us-west-1"
        • "us-west-2"
        • "ap-southeast-1"
        • "ap-southeast-2"
        • "ap-northeast-1"
        • "sa-east-1"
        • ""
    • GrantFullControl — (String) Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.
    • GrantRead — (String) Allows grantee to list the objects in the bucket.
    • GrantReadACP — (String) Allows grantee to read the bucket ACL.
    • GrantWrite — (String) Allows grantee to create, overwrite, and delete any object in the bucket.
    • GrantWriteACP — (String) Allows grantee to write the ACL for the applicable bucket.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Location — (String)

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) createMultipartUpload(params = {}, callback)

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.

Examples:

Calling the createMultipartUpload operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  ACL: 'private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control',
  CacheControl: 'STRING_VALUE',
  ContentDisposition: 'STRING_VALUE',
  ContentEncoding: 'STRING_VALUE',
  ContentLanguage: 'STRING_VALUE',
  ContentType: 'STRING_VALUE',
  Expires: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  GrantFullControl: 'STRING_VALUE',
  GrantRead: 'STRING_VALUE',
  GrantReadACP: 'STRING_VALUE',
  GrantWriteACP: 'STRING_VALUE',
  Metadata: {
    someKey: 'STRING_VALUE',
    // anotherKey: ...
  },
  ServerSideEncryption: 'AES256',
  StorageClass: 'STANDARD | REDUCED_REDUNDANCY',
  WebsiteRedirectLocation: 'STRING_VALUE',
};
s3.createMultipartUpload(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • ACL — (String) The canned ACL to apply to the object. Possible values include:
      • "private"
      • "public-read"
      • "public-read-write"
      • "authenticated-read"
      • "bucket-owner-read"
      • "bucket-owner-full-control"
    • Bucketrequired — (String)
    • 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 — (Date) The date and time at which the object is no longer cacheable.
    • GrantFullControl — (String) Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
    • GrantRead — (String) Allows grantee to read the object data and its metadata.
    • GrantReadACP — (String) Allows grantee to read the object ACL.
    • GrantWriteACP — (String) Allows grantee to write the ACL for the applicable object.
    • Keyrequired — (String)
    • Metadata — (map<String>) A map of metadata to store with the object in S3.
    • ServerSideEncryption — (String) The Server-side encryption algorithm used when storing this object in S3. Possible values include:
      • "AES256"
    • StorageClass — (String) The type of storage to use for the object. Defaults to 'STANDARD'. Possible values include:
      • "STANDARD"
      • "REDUCED_REDUNDANCY"
    • 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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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. Possible values include:
        • "AES256"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteBucket(params = {}, callback)

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.

Examples:

Calling the deleteBucket operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.deleteBucket(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteBucketCors(params = {}, callback)

Deletes the cors configuration information set for the bucket.

Examples:

Calling the deleteBucketCors operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.deleteBucketCors(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteBucketLifecycle(params = {}, callback)

Deletes the lifecycle configuration from the bucket.

Examples:

Calling the deleteBucketLifecycle operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.deleteBucketLifecycle(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteBucketPolicy(params = {}, callback)

Deletes the policy from the bucket.

Examples:

Calling the deleteBucketPolicy operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.deleteBucketPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteBucketTagging(params = {}, callback)

Deletes the tags from the bucket.

Examples:

Calling the deleteBucketTagging operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.deleteBucketTagging(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteBucketWebsite(params = {}, callback)

This operation removes the website configuration from the bucket.

Examples:

Calling the deleteBucketWebsite operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.deleteBucketWebsite(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteObject(params = {}, callback)

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.

Examples:

Calling the deleteObject operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  MFA: 'STRING_VALUE',
  VersionId: 'STRING_VALUE',
};
s3.deleteObject(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Keyrequired — (String)
    • MFA — (String) The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
    • VersionId — (String) VersionId used to reference a specific version of the object.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

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

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) deleteObjects(params = {}, callback)

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

Examples:

Calling the deleteObjects operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Delete: { // required
    Objects: [ // required
      {
        Key: 'STRING_VALUE', // required
        VersionId: 'STRING_VALUE',
      },
      // ... more items ...
    ],
    Quiet: true || false,
  },
  MFA: 'STRING_VALUE',
};
s3.deleteObjects(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Deleterequired — (map)
      • Objectsrequired — (Array<map>)
        • Keyrequired — (String) 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.
    • MFA — (String) The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Deleted — (Array<map>)
        • Key — (String)
        • VersionId — (String)
        • DeleteMarker — (Boolean)
        • DeleteMarkerVersionId — (String)
      • Errors — (Array<map>)
        • Key — (String)
        • VersionId — (String)
        • Code — (String)
        • Message — (String)

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketAcl(params = {}, callback)

Gets the access control policy for the bucket.

Examples:

Calling the getBucketAcl operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketAcl(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Owner — (map)
        • DisplayName — (String)
        • ID — (String)
      • Grants — (Array<map>) A list of grants.
        • Grantee — (map)
          • 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 Possible values include:
            • "CanonicalUser"
            • "AmazonCustomerByEmail"
            • "Group"
          • URI — (String) URI of the grantee group.
        • Permission — (String) Specifies the permission given to the grantee. Possible values include:
          • "FULL_CONTROL"
          • "WRITE"
          • "WRITE_ACP"
          • "READ"
          • "READ_ACP"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketCors(params = {}, callback)

Returns the cors configuration for the bucket.

Examples:

Calling the getBucketCors operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketCors(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CORSRules — (Array<map>)
        • AllowedHeaders — (Array<String>) Specifies which headers are allowed in a pre-flight OPTIONS request.
        • AllowedMethods — (Array<String>) Identifies HTTP methods that the domain/origin specified in the rule is allowed to execute.
        • AllowedOrigins — (Array<String>) One or more origins you want customers to be able to access the bucket from.
        • ExposeHeaders — (Array<String>) 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).
        • MaxAgeSeconds — (Integer) The time in seconds that your browser is to cache the preflight response for the specified resource.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketLifecycle(params = {}, callback)

Returns the lifecycle configuration information set on the bucket.

Examples:

Calling the getBucketLifecycle operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketLifecycle(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Rules — (Array<map>)
        • Expiration — (map)
          • Date — (Date) 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. Possible values include:
          • "Enabled"
          • "Disabled"
        • Transition — (map)
          • Date — (Date) 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. Possible values include:
            • "STANDARD"
            • "REDUCED_REDUNDANCY"
            • "GLACIER"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketLocation(params = {}, callback)

Returns the region the bucket resides in.

Examples:

Calling the getBucketLocation operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketLocation(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LocationConstraint — (String) Possible values include:
        • "EU"
        • "eu-west-1"
        • "us-west-1"
        • "us-west-2"
        • "ap-southeast-1"
        • "ap-southeast-2"
        • "ap-northeast-1"
        • "sa-east-1"
        • ""

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketLogging(params = {}, callback)

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.

Examples:

Calling the getBucketLogging operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketLogging(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • LoggingEnabled — (map)
        • 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 — (Array<map>)
          • Grantee — (map)
            • 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 Possible values include:
              • "CanonicalUser"
              • "AmazonCustomerByEmail"
              • "Group"
            • URI — (String) URI of the grantee group.
          • Permission — (String) Logging permissions assigned to the Grantee for the bucket. Possible values include:
            • "FULL_CONTROL"
            • "READ"
            • "WRITE"
        • TargetPrefix — (String) This element lets you specify a prefix for the keys that the log files will be stored under.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketNotification(params = {}, callback)

Return the notification configuration of a bucket.

Examples:

Calling the getBucketNotification operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketNotification(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TopicConfiguration — (map)
        • Event — (String) Bucket event for which to send notifications. Possible values include:
          • "s3:ReducedRedundancyLostObject"
        • Topic — (String) Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the bucket.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketPolicy(params = {}, callback)

Returns the policy of a specified bucket.

Examples:

Calling the getBucketPolicy operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Policy — (String) The bucket policy as a JSON document.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketRequestPayment(params = {}, callback)

Returns the request payment configuration of a bucket.

Examples:

Calling the getBucketRequestPayment operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketRequestPayment(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Payer — (String) Specifies who pays for the download and request fees. Possible values include:
        • "Requester"
        • "BucketOwner"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketTagging(params = {}, callback)

Returns the tag set associated with the bucket.

Examples:

Calling the getBucketTagging operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketTagging(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • TagSet — (Array<map>)
        • Key — (String) Name of the tag.
        • Value — (String) Value of the tag.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketVersioning(params = {}, callback)

Returns the versioning state of a bucket.

Examples:

Calling the getBucketVersioning operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketVersioning(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Status — (String) The versioning state of the bucket. Possible values include:
        • "Enabled"
        • "Suspended"
      • 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. Possible values include:
        • "Enabled"
        • "Disabled"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getBucketWebsite(params = {}, callback)

Returns the website configuration for a bucket.

Examples:

Calling the getBucketWebsite operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.getBucketWebsite(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • RedirectAllRequestsTo — (map)
        • 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. Possible values include:
          • "http"
          • "https"
      • IndexDocument — (map)
        • 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 — (map)
        • Key — (String) The object key name to use when a 4XX class error occurs.
      • RoutingRules — (Array<map>)
        • Condition — (map) 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 — (map) 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. Possible values include:
            • "http"
            • "https"
          • 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:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getObject(params = {}, callback)

Retrieves objects from Amazon S3.

Examples:

Calling the getObject operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  IfMatch: 'STRING_VALUE',
  IfModifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  IfNoneMatch: 'STRING_VALUE',
  IfUnmodifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  Range: 'STRING_VALUE',
  ResponseCacheControl: 'STRING_VALUE',
  ResponseContentDisposition: 'STRING_VALUE',
  ResponseContentEncoding: 'STRING_VALUE',
  ResponseContentLanguage: 'STRING_VALUE',
  ResponseContentType: 'STRING_VALUE',
  ResponseExpires: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  VersionId: 'STRING_VALUE',
};
s3.getObject(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • IfMatch — (String) Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).
    • IfModifiedSince — (Date) Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).
    • IfNoneMatch — (String) Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).
    • IfUnmodifiedSince — (Date) Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).
    • Keyrequired — (String)
    • Range — (String) 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.
    • ResponseCacheControl — (String) Sets the Cache-Control header of the response.
    • ResponseContentDisposition — (String) Sets the Content-Disposition header of the response
    • ResponseContentEncoding — (String) Sets the Content-Encoding header of the response.
    • ResponseContentLanguage — (String) Sets the Content-Language header of the response.
    • ResponseContentType — (String) Sets the Content-Type header of the response.
    • ResponseExpires — (Date) Sets the Expires header of the response.
    • VersionId — (String) VersionId used to reference a specific version of the object.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Body — (Buffer) 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 — (Date) 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 — (Date) 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 — (Date) 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. Possible values include:
        • "AES256"
      • Metadata — (map<String>) A map of metadata to store with the object in S3.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getObjectAcl(params = {}, callback)

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

Examples:

Calling the getObjectAcl operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  VersionId: 'STRING_VALUE',
};
s3.getObjectAcl(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Keyrequired — (String)
    • VersionId — (String) VersionId used to reference a specific version of the object.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Owner — (map)
        • DisplayName — (String)
        • ID — (String)
      • Grants — (Array<map>) A list of grants.
        • Grantee — (map)
          • 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 Possible values include:
            • "CanonicalUser"
            • "AmazonCustomerByEmail"
            • "Group"
          • URI — (String) URI of the grantee group.
        • Permission — (String) Specifies the permission given to the grantee. Possible values include:
          • "FULL_CONTROL"
          • "WRITE"
          • "WRITE_ACP"
          • "READ"
          • "READ_ACP"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) getObjectTorrent(params = {}, callback)

Return torrent files from a bucket.

Examples:

Calling the getObjectTorrent operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
};
s3.getObjectTorrent(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Keyrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Body — (Buffer)

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(String?) getSignedUrl(operation, params, callback)

Note:

You must ensure that you have static or previously resolved credentials if you call this method synchronously (with no callback), otherwise it may not properly sign the request. If you cannot guarantee this (you are using an asynchronous credential provider, i.e., EC2 IAM roles), you should always call this method with an asynchronous callback.

Get a pre-signed URL for a given operation name.

Examples:

Pre-signing a getObject operation (synchronously)

var params = {Bucket: 'bucket', Key: 'key'};
var url = s3.getSignedUrl('getObject', params);
console.log('The URL is', url);

Pre-signing a putObject (asynchronously)

var params = {Bucket: 'bucket', Key: 'key'};
s3.getSignedUrl('putObject', params, function (err, url) {
  console.log('The URL is', url);
});

Pre-signing a putObject operation with a specific payload

var params = {Bucket: 'bucket', Key: 'key', Body: 'body'};
var url = s3.getSignedUrl('putObject', params);
console.log('The URL is', url);

Passing in a 1-minute expiry time for a pre-signed URL

var params = {Bucket: 'bucket', Key: 'key', Expires: 60};
var url = s3.getSignedUrl('getObject', params);
console.log('The URL is', url); // expires in 60 seconds

Parameters:

  • operation (String)

    the name of the operation to call

  • params (map)

    parameters to pass to the operation. See the given operation for the expected operation parameters. In addition, you can also pass the "Expires" parameter to inform S3 how long the URL should work for.

  • callback (Function)

    if a callback is provided, this function will pass the URL as the second parameter (after the error parameter) to the callback function.

Options Hash (params):

  • Expires (Integer) — default: 900

    the number of seconds to expire the pre-signed URL operation in. Defaults to 15 minutes.

Returns:

  • (String)

    if called synchronously (with no callback), returns the signed URL.

  • (null)

    nothing is returned if a callback is provided.

(AWS.Request) headBucket(params = {}, callback)

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

Examples:

Calling the headBucket operation

var params = {
  Bucket: 'STRING_VALUE', // required
};
s3.headBucket(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) headObject(params = {}, callback)

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.

Examples:

Calling the headObject operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  IfMatch: 'STRING_VALUE',
  IfModifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  IfNoneMatch: 'STRING_VALUE',
  IfUnmodifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  Range: 'STRING_VALUE',
  VersionId: 'STRING_VALUE',
};
s3.headObject(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • IfMatch — (String) Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed).
    • IfModifiedSince — (Date) Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).
    • IfNoneMatch — (String) Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified).
    • IfUnmodifiedSince — (Date) Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed).
    • Keyrequired — (String)
    • Range — (String) 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.
    • VersionId — (String) VersionId used to reference a specific version of the object.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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 — (Date) 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 — (Date) 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 — (Date) 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. Possible values include:
        • "AES256"
      • Metadata — (map<String>) A map of metadata to store with the object in S3.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) listBuckets(params = {}, callback)

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

Examples:

Calling the listBuckets operation

var params = {
};
s3.listBuckets(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Buckets — (Array<map>)
        • Name — (String) The name of the bucket.
        • CreationDate — (Date) Date the bucket was created.
      • Owner — (map)
        • DisplayName — (String)
        • ID — (String)

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) listMultipartUploads(params = {}, callback)

This operation lists in-progress multipart uploads.

Examples:

Calling the listMultipartUploads operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Delimiter: 'STRING_VALUE',
  EncodingType: 'url',
  KeyMarker: 'STRING_VALUE',
  MaxUploads: 0,
  Prefix: 'STRING_VALUE',
  UploadIdMarker: 'STRING_VALUE',
};
s3.listMultipartUploads(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Delimiter — (String) Character you use to group keys.
    • EncodingType — (String) Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response. Possible values include:
      • "url"
    • KeyMarker — (String) Together with upload-id-marker, this parameter specifies the multipart upload after which listing should begin.
    • MaxUploads — (Integer) Sets the maximum number of multipart uploads, from 1 to 1,000, to return in the response body. 1,000 is the maximum number of uploads that can be returned in a response.
    • Prefix — (String) Lists in-progress uploads only for those keys that begin with the specified prefix.
    • UploadIdMarker — (String) Together with key-marker, specifies the multipart upload after which listing should begin. If key-marker is not specified, the upload-id-marker parameter is ignored.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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 — (Array<map>)
        • UploadId — (String) Upload ID that identifies the multipart upload.
        • Key — (String) Key of the object for which the multipart upload was initiated.
        • Initiated — (Date) Date and time at which the multipart upload was initiated.
        • StorageClass — (String) The class of storage used to store the object. Possible values include:
          • "STANDARD"
          • "REDUCED_REDUNDANCY"
          • "GLACIER"
        • Owner — (map)
          • DisplayName — (String)
          • ID — (String)
        • Initiator — (map) 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 — (Array<map>)
        • Prefix — (String)
      • EncodingType — (String) Encoding type used by Amazon S3 to encode object keys in the response. Possible values include:
        • "url"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) listObjects(params = {}, callback)

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.

Examples:

Calling the listObjects operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Delimiter: 'STRING_VALUE',
  EncodingType: 'url',
  Marker: 'STRING_VALUE',
  MaxKeys: 0,
  Prefix: 'STRING_VALUE',
};
s3.listObjects(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Delimiter — (String) A delimiter is a character you use to group keys.
    • EncodingType — (String) Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response. Possible values include:
      • "url"
    • Marker — (String) Specifies the key to start with when listing objects in a bucket.
    • MaxKeys — (Integer) Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more.
    • Prefix — (String) Limits the response to keys that begin with the specified prefix.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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 — (Array<map>)
        • Key — (String)
        • LastModified — (Date)
        • ETag — (String)
        • Size — (Integer)
        • StorageClass — (String) The class of storage used to store the object. Possible values include:
          • "STANDARD"
          • "REDUCED_REDUNDANCY"
          • "GLACIER"
        • Owner — (map)
          • DisplayName — (String)
          • ID — (String)
      • Name — (String)
      • Prefix — (String)
      • MaxKeys — (Integer)
      • CommonPrefixes — (Array<map>)
        • Prefix — (String)
      • EncodingType — (String) Encoding type used by Amazon S3 to encode object keys in the response. Possible values include:
        • "url"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) listObjectVersions(params = {}, callback)

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

Examples:

Calling the listObjectVersions operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Delimiter: 'STRING_VALUE',
  EncodingType: 'url',
  KeyMarker: 'STRING_VALUE',
  MaxKeys: 0,
  Prefix: 'STRING_VALUE',
  VersionIdMarker: 'STRING_VALUE',
};
s3.listObjectVersions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Delimiter — (String) A delimiter is a character you use to group keys.
    • EncodingType — (String) Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response. Possible values include:
      • "url"
    • KeyMarker — (String) Specifies the key to start with when listing objects in a bucket.
    • MaxKeys — (Integer) Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more.
    • Prefix — (String) Limits the response to keys that begin with the specified prefix.
    • VersionIdMarker — (String) Specifies the object version you want to start listing from.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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 — (Array<map>)
        • ETag — (String)
        • Size — (Integer) Size in bytes of the object.
        • StorageClass — (String) The class of storage used to store the object. Possible values include:
          • "STANDARD"
          • "REDUCED_REDUNDANCY"
          • "GLACIER"
        • 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 — (Date) Date and time the object was last modified.
        • Owner — (map)
          • DisplayName — (String)
          • ID — (String)
      • DeleteMarkers — (Array<map>)
        • Owner — (map)
          • 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 — (Date) Date and time the object was last modified.
      • Name — (String)
      • Prefix — (String)
      • MaxKeys — (Integer)
      • CommonPrefixes — (Array<map>)
        • Prefix — (String)
      • EncodingType — (String) Encoding type used by Amazon S3 to encode object keys in the response. Possible values include:
        • "url"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) listParts(params = {}, callback)

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

Examples:

Calling the listParts operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  UploadId: 'STRING_VALUE', // required
  MaxParts: 0,
  PartNumberMarker: 0,
};
s3.listParts(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Keyrequired — (String)
    • MaxParts — (Integer) Sets the maximum number of parts to return.
    • PartNumberMarker — (Integer) Specifies the part after which listing should begin. Only parts with higher part numbers will be listed.
    • UploadIdrequired — (String) Upload ID identifying the multipart upload whose parts are being listed.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • 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 — (Array<map>)
        • PartNumber — (Integer) Part number identifying the part.
        • LastModified — (Date) 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 — (map) 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 — (map)
        • DisplayName — (String)
        • ID — (String)
      • StorageClass — (String) The class of storage used to store the object. Possible values include:
        • "STANDARD"
        • "REDUCED_REDUNDANCY"
        • "GLACIER"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketAcl(params = {}, callback)

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

Examples:

Calling the putBucketAcl operation

var params = {
  Bucket: 'STRING_VALUE', // required
  ACL: 'private | public-read | public-read-write | authenticated-read',
  AccessControlPolicy: {
    Grants: [
      {
        Grantee: {
          Type: 'CanonicalUser | AmazonCustomerByEmail | Group', // required
          DisplayName: 'STRING_VALUE',
          EmailAddress: 'STRING_VALUE',
          ID: 'STRING_VALUE',
          URI: 'STRING_VALUE',
        },
        Permission: 'FULL_CONTROL | WRITE | WRITE_ACP | READ | READ_ACP',
      },
      // ... more items ...
    ],
    Owner: {
      DisplayName: 'STRING_VALUE',
      ID: 'STRING_VALUE',
    },
  },
  ContentMD5: 'STRING_VALUE',
  GrantFullControl: 'STRING_VALUE',
  GrantRead: 'STRING_VALUE',
  GrantReadACP: 'STRING_VALUE',
  GrantWrite: 'STRING_VALUE',
  GrantWriteACP: 'STRING_VALUE',
};
s3.putBucketAcl(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • ACL — (String) The canned ACL to apply to the bucket. Possible values include:
      • "private"
      • "public-read"
      • "public-read-write"
      • "authenticated-read"
    • AccessControlPolicy — (map)
      • Grants — (Array<map>) A list of grants.
        • Grantee — (map)
          • DisplayName — (String) Screen name of the grantee.
          • EmailAddress — (String) Email address of the grantee.
          • ID — (String) The canonical user ID of the grantee.
          • Typerequired — (String) Type of grantee Possible values include:
            • "CanonicalUser"
            • "AmazonCustomerByEmail"
            • "Group"
          • URI — (String) URI of the grantee group.
        • Permission — (String) Specifies the permission given to the grantee. Possible values include:
          • "FULL_CONTROL"
          • "WRITE"
          • "WRITE_ACP"
          • "READ"
          • "READ_ACP"
      • Owner — (map)
        • DisplayName — (String)
        • ID — (String)
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • GrantFullControl — (String) Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.
    • GrantRead — (String) Allows grantee to list the objects in the bucket.
    • GrantReadACP — (String) Allows grantee to read the bucket ACL.
    • GrantWrite — (String) Allows grantee to create, overwrite, and delete any object in the bucket.
    • GrantWriteACP — (String) Allows grantee to write the ACL for the applicable bucket.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketCors(params = {}, callback)

Sets the cors configuration for a bucket.

Examples:

Calling the putBucketCors operation

var params = {
  Bucket: 'STRING_VALUE', // required
  CORSConfiguration: {
    CORSRules: [
      {
        AllowedHeaders: [
          'STRING_VALUE',
          // ... more items ...
        ],
        AllowedMethods: [
          'STRING_VALUE',
          // ... more items ...
        ],
        AllowedOrigins: [
          'STRING_VALUE',
          // ... more items ...
        ],
        ExposeHeaders: [
          'STRING_VALUE',
          // ... more items ...
        ],
        MaxAgeSeconds: 0,
      },
      // ... more items ...
    ],
  },
  ContentMD5: 'STRING_VALUE',
};
s3.putBucketCors(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • CORSConfiguration — (map)
      • CORSRules — (Array<map>)
        • AllowedHeaders — (Array<String>) Specifies which headers are allowed in a pre-flight OPTIONS request.
        • AllowedMethods — (Array<String>) Identifies HTTP methods that the domain/origin specified in the rule is allowed to execute.
        • AllowedOrigins — (Array<String>) One or more origins you want customers to be able to access the bucket from.
        • ExposeHeaders — (Array<String>) 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).
        • MaxAgeSeconds — (Integer) The time in seconds that your browser is to cache the preflight response for the specified resource.
    • ContentMD5 — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketLifecycle(params = {}, callback)

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

Examples:

Calling the putBucketLifecycle operation

var params = {
  Bucket: 'STRING_VALUE', // required
  ContentMD5: 'STRING_VALUE',
  LifecycleConfiguration: {
    Rules: [ // required
      {
        Prefix: 'STRING_VALUE', // required
        Status: 'Enabled | Disabled', // required
        Expiration: {
          Date: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
          Days: 0,
        },
        ID: 'STRING_VALUE',
        Transition: {
          Date: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
          Days: 0,
          StorageClass: 'STANDARD | REDUCED_REDUNDANCY | GLACIER',
        },
      },
      // ... more items ...
    ],
  },
};
s3.putBucketLifecycle(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • LifecycleConfiguration — (map)
      • Rulesrequired — (Array<map>)
        • Expiration — (map)
          • Date — (Date) 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.
        • Prefixrequired — (String) Prefix identifying one or more objects to which the rule applies.
        • Statusrequired — (String) If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied. Possible values include:
          • "Enabled"
          • "Disabled"
        • Transition — (map)
          • Date — (Date) 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. Possible values include:
            • "STANDARD"
            • "REDUCED_REDUNDANCY"
            • "GLACIER"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketLogging(params = {}, callback)

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.

Examples:

Calling the putBucketLogging operation

var params = {
  Bucket: 'STRING_VALUE', // required
  BucketLoggingStatus: { // required
    LoggingEnabled: {
      TargetBucket: 'STRING_VALUE',
      TargetGrants: [
        {
          Grantee: {
            Type: 'CanonicalUser | AmazonCustomerByEmail | Group', // required
            DisplayName: 'STRING_VALUE',
            EmailAddress: 'STRING_VALUE',
            ID: 'STRING_VALUE',
            URI: 'STRING_VALUE',
          },
          Permission: 'FULL_CONTROL | READ | WRITE',
        },
        // ... more items ...
      ],
      TargetPrefix: 'STRING_VALUE',
    },
  },
  ContentMD5: 'STRING_VALUE',
};
s3.putBucketLogging(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • BucketLoggingStatusrequired — (map)
      • LoggingEnabled — (map)
        • 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 — (Array<map>)
          • Grantee — (map)
            • DisplayName — (String) Screen name of the grantee.
            • EmailAddress — (String) Email address of the grantee.
            • ID — (String) The canonical user ID of the grantee.
            • Typerequired — (String) Type of grantee Possible values include:
              • "CanonicalUser"
              • "AmazonCustomerByEmail"
              • "Group"
            • URI — (String) URI of the grantee group.
          • Permission — (String) Logging permissions assigned to the Grantee for the bucket. Possible values include:
            • "FULL_CONTROL"
            • "READ"
            • "WRITE"
        • TargetPrefix — (String) This element lets you specify a prefix for the keys that the log files will be stored under.
    • ContentMD5 — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketNotification(params = {}, callback)

Enables notifications of specified events for a bucket.

Examples:

Calling the putBucketNotification operation

var params = {
  Bucket: 'STRING_VALUE', // required
  NotificationConfiguration: { // required
    TopicConfiguration: { // required
      Event: 's3:ReducedRedundancyLostObject',
      Topic: 'STRING_VALUE',
    },
  },
  ContentMD5: 'STRING_VALUE',
};
s3.putBucketNotification(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • NotificationConfigurationrequired — (map)
      • TopicConfigurationrequired — (map)
        • Event — (String) Bucket event for which to send notifications. Possible values include:
          • "s3:ReducedRedundancyLostObject"
        • Topic — (String) Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the bucket.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketPolicy(params = {}, callback)

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

Examples:

Calling the putBucketPolicy operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Policy: 'STRING_VALUE', // required
  ContentMD5: 'STRING_VALUE',
};
s3.putBucketPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • Policyrequired — (String) The bucket policy as a JSON document.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketRequestPayment(params = {}, callback)

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.

Examples:

Calling the putBucketRequestPayment operation

var params = {
  Bucket: 'STRING_VALUE', // required
  RequestPaymentConfiguration: { // required
    Payer: 'Requester | BucketOwner', // required
  },
  ContentMD5: 'STRING_VALUE',
};
s3.putBucketRequestPayment(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • RequestPaymentConfigurationrequired — (map)
      • Payerrequired — (String) Specifies who pays for the download and request fees. Possible values include:
        • "Requester"
        • "BucketOwner"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketTagging(params = {}, callback)

Sets the tags for a bucket.

Examples:

Calling the putBucketTagging operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Tagging: { // required
    TagSet: [ // required
      {
        Key: 'STRING_VALUE', // required
        Value: 'STRING_VALUE', // required
      },
      // ... more items ...
    ],
  },
  ContentMD5: 'STRING_VALUE',
};
s3.putBucketTagging(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • Taggingrequired — (map)
      • TagSetrequired — (Array<map>)
        • Keyrequired — (String) Name of the tag.
        • Valuerequired — (String) Value of the tag.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketVersioning(params = {}, callback)

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

Examples:

Calling the putBucketVersioning operation

var params = {
  Bucket: 'STRING_VALUE', // required
  VersioningConfiguration: { // required
    MFADelete: 'Enabled | Disabled',
    Status: 'Enabled | Suspended',
  },
  ContentMD5: 'STRING_VALUE',
  MFA: 'STRING_VALUE',
};
s3.putBucketVersioning(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • MFA — (String) The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device.
    • VersioningConfigurationrequired — (map)
      • 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. Possible values include:
        • "Enabled"
        • "Disabled"
      • Status — (String) The versioning state of the bucket. Possible values include:
        • "Enabled"
        • "Suspended"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putBucketWebsite(params = {}, callback)

Set the website configuration for a bucket.

Examples:

Calling the putBucketWebsite operation

var params = {
  Bucket: 'STRING_VALUE', // required
  WebsiteConfiguration: { // required
    ErrorDocument: {
      Key: 'STRING_VALUE', // required
    },
    IndexDocument: {
      Suffix: 'STRING_VALUE', // required
    },
    RedirectAllRequestsTo: {
      HostName: 'STRING_VALUE', // required
      Protocol: 'http | https',
    },
    RoutingRules: [
      {
        Redirect: { // required
          HostName: 'STRING_VALUE',
          HttpRedirectCode: 'STRING_VALUE',
          Protocol: 'http | https',
          ReplaceKeyPrefixWith: 'STRING_VALUE',
          ReplaceKeyWith: 'STRING_VALUE',
        },
        Condition: {
          HttpErrorCodeReturnedEquals: 'STRING_VALUE',
          KeyPrefixEquals: 'STRING_VALUE',
        },
      },
      // ... more items ...
    ],
  },
  ContentMD5: 'STRING_VALUE',
};
s3.putBucketWebsite(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • WebsiteConfigurationrequired — (map)
      • ErrorDocument — (map)
        • Keyrequired — (String) The object key name to use when a 4XX class error occurs.
      • IndexDocument — (map)
        • Suffixrequired — (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.
      • RedirectAllRequestsTo — (map)
        • HostNamerequired — (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. Possible values include:
          • "http"
          • "https"
      • RoutingRules — (Array<map>)
        • Condition — (map) 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.
        • Redirectrequired — (map) 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. Possible values include:
            • "http"
            • "https"
          • 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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putObject(params = {}, callback)

Adds an object to a bucket.

Examples:

Calling the putObject operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  ACL: 'private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control',
  Body: new Buffer('...') || streamObject || 'STRING_VALUE',
  CacheControl: 'STRING_VALUE',
  ContentDisposition: 'STRING_VALUE',
  ContentEncoding: 'STRING_VALUE',
  ContentLanguage: 'STRING_VALUE',
  ContentLength: 0,
  ContentMD5: 'STRING_VALUE',
  ContentType: 'STRING_VALUE',
  Expires: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  GrantFullControl: 'STRING_VALUE',
  GrantRead: 'STRING_VALUE',
  GrantReadACP: 'STRING_VALUE',
  GrantWriteACP: 'STRING_VALUE',
  Metadata: {
    someKey: 'STRING_VALUE',
    // anotherKey: ...
  },
  ServerSideEncryption: 'AES256',
  StorageClass: 'STANDARD | REDUCED_REDUNDANCY',
  WebsiteRedirectLocation: 'STRING_VALUE',
};
s3.putObject(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • ACL — (String) The canned ACL to apply to the object. Possible values include:
      • "private"
      • "public-read"
      • "public-read-write"
      • "authenticated-read"
      • "bucket-owner-read"
      • "bucket-owner-full-control"
    • Body — (Buffer)
    • Bucketrequired — (String)
    • 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.
    • ContentLength — (Integer) Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically.
    • ContentMD5 — (String)
    • ContentType — (String) A standard MIME type describing the format of the object data.
    • Expires — (Date) The date and time at which the object is no longer cacheable.
    • GrantFullControl — (String) Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
    • GrantRead — (String) Allows grantee to read the object data and its metadata.
    • GrantReadACP — (String) Allows grantee to read the object ACL.
    • GrantWriteACP — (String) Allows grantee to write the ACL for the applicable object.
    • Keyrequired — (String)
    • Metadata — (map<String>) A map of metadata to store with the object in S3.
    • ServerSideEncryption — (String) The Server-side encryption algorithm used when storing this object in S3. Possible values include:
      • "AES256"
    • StorageClass — (String) The type of storage to use for the object. Defaults to 'STANDARD'. Possible values include:
      • "STANDARD"
      • "REDUCED_REDUNDANCY"
    • 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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Expiration — (Date) 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. Possible values include:
        • "AES256"
      • VersionId — (String) Version of the object.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) putObjectAcl(params = {}, callback)

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

Examples:

Calling the putObjectAcl operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  ACL: 'private | public-read | public-read-write | authenticated-read | bucket-owner-read | bucket-owner-full-control',
  AccessControlPolicy: {
    Grants: [
      {
        Grantee: {
          Type: 'CanonicalUser | AmazonCustomerByEmail | Group', // required
          DisplayName: 'STRING_VALUE',
          EmailAddress: 'STRING_VALUE',
          ID: 'STRING_VALUE',
          URI: 'STRING_VALUE',
        },
        Permission: 'FULL_CONTROL | WRITE | WRITE_ACP | READ | READ_ACP',
      },
      // ... more items ...
    ],
    Owner: {
      DisplayName: 'STRING_VALUE',
      ID: 'STRING_VALUE',
    },
  },
  ContentMD5: 'STRING_VALUE',
  GrantFullControl: 'STRING_VALUE',
  GrantRead: 'STRING_VALUE',
  GrantReadACP: 'STRING_VALUE',
  GrantWrite: 'STRING_VALUE',
  GrantWriteACP: 'STRING_VALUE',
};
s3.putObjectAcl(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • ACL — (String) The canned ACL to apply to the object. Possible values include:
      • "private"
      • "public-read"
      • "public-read-write"
      • "authenticated-read"
      • "bucket-owner-read"
      • "bucket-owner-full-control"
    • AccessControlPolicy — (map)
      • Grants — (Array<map>) A list of grants.
        • Grantee — (map)
          • DisplayName — (String) Screen name of the grantee.
          • EmailAddress — (String) Email address of the grantee.
          • ID — (String) The canonical user ID of the grantee.
          • Typerequired — (String) Type of grantee Possible values include:
            • "CanonicalUser"
            • "AmazonCustomerByEmail"
            • "Group"
          • URI — (String) URI of the grantee group.
        • Permission — (String) Specifies the permission given to the grantee. Possible values include:
          • "FULL_CONTROL"
          • "WRITE"
          • "WRITE_ACP"
          • "READ"
          • "READ_ACP"
      • Owner — (map)
        • DisplayName — (String)
        • ID — (String)
    • Bucketrequired — (String)
    • ContentMD5 — (String)
    • GrantFullControl — (String) Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.
    • GrantRead — (String) Allows grantee to list the objects in the bucket.
    • GrantReadACP — (String) Allows grantee to read the bucket ACL.
    • GrantWrite — (String) Allows grantee to create, overwrite, and delete any object in the bucket.
    • GrantWriteACP — (String) Allows grantee to write the ACL for the applicable bucket.
    • Keyrequired — (String)

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) restoreObject(params = {}, callback)

Restores an archived copy of an object back into Amazon S3

Examples:

Calling the restoreObject operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  RestoreRequest: {
    Days: 0, // required
  },
};
s3.restoreObject(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • Keyrequired — (String)
    • RestoreRequest — (map)
      • Daysrequired — (Integer) Lifetime of the active copy in days

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) uploadPart(params = {}, callback)

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.

Examples:

Calling the uploadPart operation

var params = {
  Bucket: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  PartNumber: 0, // required
  UploadId: 'STRING_VALUE', // required
  Body: new Buffer('...') || streamObject || 'STRING_VALUE',
  ContentLength: 0,
  ContentMD5: 'STRING_VALUE',
};
s3.uploadPart(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Body — (Buffer)
    • Bucketrequired — (String)
    • ContentLength — (Integer) Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically.
    • ContentMD5 — (String)
    • Keyrequired — (String)
    • PartNumberrequired — (Integer) Part number of part being uploaded.
    • UploadIdrequired — (String) Upload ID identifying the multipart upload whose part is being uploaded.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • ServerSideEncryption — (String) The Server-side encryption algorithm used when storing this object in S3. Possible values include:
        • "AES256"
      • ETag — (String) Entity tag for the uploaded object.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also:

(AWS.Request) uploadPartCopy(params = {}, callback)

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

Examples:

Calling the uploadPartCopy operation

var params = {
  Bucket: 'STRING_VALUE', // required
  CopySource: 'STRING_VALUE', // required
  Key: 'STRING_VALUE', // required
  PartNumber: 0, // required
  UploadId: 'STRING_VALUE', // required
  CopySourceIfMatch: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  CopySourceIfModifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  CopySourceIfNoneMatch: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  CopySourceIfUnmodifiedSince: new Date || 'Wed Dec 31 1969 16:00:00 GMT-0800 (PST)' || 123456789,
  CopySourceRange: 'STRING_VALUE',
};
s3.uploadPartCopy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
}

Parameters:

  • params (Object) (defaults to: {})
    • Bucketrequired — (String)
    • CopySourcerequired — (String) The name of the source bucket and key name of the source object, separated by a slash (/). Must be URL-encoded.
    • CopySourceIfMatch — (Date) Copies the object if its entity tag (ETag) matches the specified tag.
    • CopySourceIfModifiedSince — (Date) Copies the object if it has been modified since the specified time.
    • CopySourceIfNoneMatch — (Date) Copies the object if its entity tag (ETag) is different than the specified ETag.
    • CopySourceIfUnmodifiedSince — (Date) Copies the object if it hasn't been modified since the specified time.
    • CopySourceRange — (String) 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.
    • Keyrequired — (String)
    • PartNumberrequired — (Integer) Part number of part being copied.
    • UploadIdrequired — (String) Upload ID identifying the multipart upload whose part is being copied.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CopySourceVersionId — (String) The version of the source object that was copied, if you have enabled versioning on the source bucket.
      • ServerSideEncryption — (String) The Server-side encryption algorithm used when storing this object in S3. Possible values include:
        • "AES256"
      • ETag — (String) Entity tag of the object.
      • LastModified — (Date) Date and time at which the object was uploaded.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

See Also: