View Categories

Bucket Ops

Bucket Operations

PUT Bucket

Creates a new bucket. To create a bucket, you must have a user ID and a valid AWS Access Key ID to authenticate requests. You may not create buckets as an anonymous user.

Constraints

  • In general, bucket names should follow domain name constraints.
  • Bucket names must be unique.
  • Bucket names cannot be formatted as IP address.
  • Bucket names can be between 3 and 63 characters long.
  • Bucket names must not contain uppercase characters or underscores.
  • Bucket names must start with a lowercase letter or number.
  • Bucket names must be a series of one or more labels. Adjacent labels are separated by a single period (.). Bucket names can contain lowercase letters, numbers, and hyphens. Each label must start and end with a lowercase letter or a number.

Syntax

PUT /{bucket} HTTP/1.1

Host: s3.eu-west-1.peasoup.cloud

x-amz-acl: public-read-write Authorization: AWS {access-key}:{hash-of-header-and-secret}

Parameters

NameDescriptionValid ValuesRequired
x-amz-aclCanned ACLs.private, public-read, public-read-write, authenticated-readNo
x-amz-bucket-object-lock-enabledEnable object lock on bucket. | true, falseNo

Note: Object Lock works only with buckets that have Versioning see,  Enable/Suspend Bucket Versioning section

Request Entities

NameTypeDescription
CreateBucketConfigurationContainerA container for the bucket configuration.
LocationConstraintStringA zonegroup api name, with optional S3 Bucket Placement

HTTP Response

If the bucket name is unique, within constraints and unused, the operation will succeed. If a bucket with the same name already exists and the user is the bucket owner, the operation will succeed. If the bucket name is already in use, the operation will fail.

HTTP StatusStatus CodeDescription
409BucketAlreadyExistsBucket already exists under different user’s ownership.

Delete Bucket

Deletes a bucket. You can reuse bucket names following a successful bucket removal.

Syntax

DELETE /{bucket} HTTP/1.1

Host: s3.eu-west-1.peasoup.cloud

Authorization: AWS {access-key}:{hash-of-header-and-secret}

HTTP Response

HTTP StatusStatus CodeDescription
204No ContentBucket removed.

Get Bucket

Returns a list of bucket objects.

Syntax

GET /{bucket}?max-keys=25 HTTP/1.1

Host: s3.eu-west-1.peasoup.cloud

Parameters

NameTypeDescription
prefixStringOnly returns objects that contain the specified prefix.
delimiterStringThe delimiter between the prefix and the rest of the object name.
markerStringA beginning index for the list of objects returned.
max-keysIntegerThe maximum number of keys to return. Default is 1000.
allow-unorderedBooleanNon-standard extension. Allows results to be returned unordered. Cannot be used with a delimiter.

HTTP Response

HTTP StatusStatus CodeDescription
200OKBuckets retrieved

Bucket Response Entities

GET /{bucket} returns a container for buckets with the following fields.

NameTypeDescription
ListBucketResultEntityThe container for the list of objects.
NameStringThe name of the bucket whose contents will be returned.
PrefixStringA prefix for the object keys.
MarkerStringA beginning index for the list of objects returned.
MaxKeysIntegerThe maximum number of keys returned.
DelimiterStringIf set, objects with the same prefix will appear in the CommonPrefixes list.
IsTruncatedBooleanIf true, only a subset of the bucket’s contents were returned.
CommonPrefixesContainerIf multiple objects contain the same prefix, they will appear in this list.

Object Response Entities

The ListBucketResult contains objects, where each object is within a Contents container.The ListBucketResult contains objects, where each object is within a Contents container.

NameTypeDescription
ContentsObjectA container for the object.
KeyStringThe object’s key.
LastModifiedDateThe object’s last-modified date/time.
ETagStringAn MD-5 hash of the object. (entity tag)
SizeIntegerThe object’s size.
StorageClassStringShould always return STANDARD.
TypeStringAppendable or Normal.

Get Bucket Location

Retrieves the bucket’s region. The user needs to be the bucket owner to call this. A bucket can be constrained to a region by providing LocationConstraint during a PUT request.

Syntax

Add the location subresource to bucket resource as shown below:

GET /{bucket}?location HTTP/1.1

Host: s3.eu-west-1.peasoup.cloud

Authorization: AWS {access-key}:{hash-of-header-and-secret}

Response Entities

NameTypeDescription
LocationConstraintStringThe region where bucket resides, empty string for default region

Get Bucket ACL

Retrieves the bucket access control list. The user needs to be the bucket owner or to have been granted READ_ACP permission on the bucket.

Syntax

Add the acl subresource to the bucket request as shown below:

GET /{bucket}?acl HTTP/1.1

Host: s3.eu-west-1.peasoup.cloud

Authorization: AWS {access-key}:{hash-of-header-and-secret}

Response Entities

NameTypeDescription
AccessControlPolicyContainerA container for the response.
AccessControlListContainerA container for the ACL information.
OwnerContainerA container for the bucket owner’s ID and DisplayName.
IDStringThe bucket owner’s ID.
DisplayNameStringThe bucket owner’s display name.
GrantContainerA container for Grantee and Permission.
GranteeContainerA container for the DisplayName and ID of the user receiving a grant of permission.
PermissionStringThe permission given to the Grantee bucket.

Put Bucket ACL

Sets an access control to an existing bucket. The user needs to be the bucket owner or to have been granted WRITE_ACP permission on the bucket.

Syntax

Add the acl subresource to the bucket request as shown below.

PUT /{bucket}?acl HTTP/1.1

Request Entities

NameTypeDescription
AccessControlPolicyContainerA container for the request.
AccessControlListContainerA container for the ACL information.
OwnerContainerA container for the bucket owner’s ID and DisplayName.
IDStringThe bucket owner’s ID.
DisplayNameStringThe bucket owner’s display name.
GrantContainerA container for Grantee and Permission.
GranteeContainerA container for the DisplayName and ID of the user receiving a grant of permission.
PermissionStringThe permission given to the Grantee bucket.

List Bucket Multipart Uploads

GET /?uploads returns a list of the current in-progress multipart uploads–i.e., the application initiates a multipart upload, but the service hasn’t completed all the uploads yet.

Syntax

GET /{bucket}?uploads HTTP/1.1

Parameters

You may specify parameters for GET /{bucket}?uploads, but none of them are required.

NameTypeDescription
prefixStringReturns in-progress uploads whose keys contains the specified prefix.
delimiterStringThe delimiter between the prefix and the rest of the object name.
key-markerStringThe beginning marker for the list of uploads.
max-keysIntegerThe maximum number of in-progress uploads. The default is 1000.
max-uploadsIntegerThe maximum number of multipart uploads. The range from 1-1000. The default is 1000.
upload-id-markerStringIgnored if key-marker is not specified. Specifies the ID of first upload to list in lexicographical order at or following the ID.

Response Entities

NameTypeDescription
ListMultipartUploadsResultContainerA container for the results.
ListMultipartUploadsResult.PrefixStringThe prefix specified by the prefix request parameter (if any).
BucketStringThe bucket that will receive the bucket contents.
KeyMarkerStringThe key marker specified by the key-marker request parameter (if any).
UploadIdMarkerStringThe marker specified by the upload-id-marker request parameter (if any).
NextKeyMarkerStringThe key marker to use in a subsequent request if IsTruncated is true.
NextUploadIdMarkerStringThe upload ID marker to use in a subsequent request if IsTruncated is true.
MaxUploadsIntegerThe max uploads specified by the max-uploads request parameter.
DelimiterStringIf set, objects with the same prefix will appear in the CommonPrefixes list.
IsTruncatedBooleanIf true, only a subset of the bucket’s upload contents were returned.
UploadContainerA container for Key, UploadId, InitiatorOwner, StorageClass, and Initiated elements.
KeyStringThe key of the object once the multipart upload is complete.
UploadIdStringThe ID that identifies the multipart upload.
InitiatorContainerContains the ID and DisplayName of the user who initiated the upload.
DisplayNameStringThe initiator’s display name.
IDStringThe initiator’s ID.
OwnerContainerA container for the ID and DisplayName of the user who owns the uploaded object.
StorageClassStringThe method used to store the resulting object. STANDARD or REDUCED_REDUNDANCY
InitiatedDateThe date and time the user initiated the upload.
CommonPrefixesContainerIf multiple objects contain the same prefix, they will appear in this list.
CommonPrefixes.PrefixStringThe substring of the key after the prefix as defined by the prefix request parameter.

Enable/Suspend Bucket Versioning

PUT /?versioning This subresource set the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner.

You can set the versioning state with one of the following values:

  • Enabled : Enables versioning for the objects in the bucket, All objects added to the bucket receive a unique version ID.
  • Suspended : Disables versioning for the objects in the bucket, All objects added to the bucket receive the version ID null.

If the versioning state has never been set on a bucket, it has no versioning state; a GET versioning request does not return a versioning state value.

Syntax

PUT  /{bucket}?versioning  HTTP/1.1

REQUEST ENTITIES

NameTypeDescription
VersioningConfigurationContainerA container for the request.
StatusStringSets the versioning state of the bucket. Valid Values: Suspended/Enabled

Put Bucket Object Lock

Places an Object Lock configuration on the specified bucket. The rule specified in the Object Lock configuration will be applied by default to every new object placed in the specified bucket.

SYNTAX

PUT /{bucket}?object-lock HTTP/1.1

REQUEST ENTITIES

NameTypeDescriptionRequired
ObjectLockConfigurationContainerA container for the request.Yes
ObjectLockEnabledStringIndicates whether this bucket has an Object Lock configuration enabled.Yes
RuleContainerThe Object Lock rule in place for the specified bucket.No
DefaultRetentionContainerThe default retention period applied to new objects placed in the specified bucket.No
ModeStringThe default Object Lock retention mode. Valid Values: GOVERNANCE/COMPLIANCEYes
DaysIntegerThe number of days specified for the default retention period.No
YearsIntegerThe number of years specified for the default retention period.No

HTTP Response

If the bucket object lock is not enabled when creating the bucket, the operation will fail.

HTTP StatusStatus CodeDescription
400MalformedXMLThe XML is not well-formed
409InvalidBucketStateThe bucket object lock is not enabled

Get Bucket Object Lock

Gets the Object Lock configuration for a bucket. The rule specified in the Object Lock configuration will be applied by default to every new object placed in the specified bucket.

Syntax

GET /{bucket}?object-lock HTTP/1.1

Response Entities

NameTypeDescriptionRequired
ObjectLockConfigurationContainerA container for the request.Yes
ObjectLockEnabledStringIndicates whether this bucket has an Object Lock configuration enabled.Yes
RuleContainerThe Object Lock rule in place for the specified bucket.No
DefaultRetentionContainerThe default retention period applied to new objects placed in the specified bucket.No
ModeStringThe default Object Lock retention mode. Valid Values: GOVERNANCE/COMPLIANCEYes
DaysIntegerThe number of days specified for the default retention period.No
YearsIntegerThe number of years specified for the default retention period.No

Create Notification

Create a publisher for a specific bucket into a topic.

Syntax

PUT /{bucket}?notification HTTP/1.1

Request Entities

Parameters are XML encoded in the body of the request, in the following format:

<NotificationConfiguration xmlns=”http://s3.amazonaws.com/doc/2006-03-01/”>

            <TopicConfiguration>

             <Id></Id>

             <Topic></Topic>

             <Event></Event>

             <Filter>

             <S3Key>

              <FilterRule>

                           <Name></Name>

                           <Value></Value>

              </FilterRule>

             </S3Key>

             <S3Metadata>

             <FilterRule>

                           <Name></Name>

                           <Value></Value>

             </FilterRule>

             </S3Metadata>

             <S3Tags>

             <FilterRule>

                           <Name></Name>

                           <Value></Value>

             </FilterRule>

             </S3Tags>

             </Filter>

            </TopicConfiguration>

</NotificationConfiguration>

NameTypeDescriptionRequired
NotificationConfigurationContainerHolding list of TopicConfiguration entitiesYes
TopicConfigurationContainerHolding Id, Topic and list of Event entitiesYes
IdStringName of the notificationYes
TopicStringTopic ARN. Topic must be created beforehandYes
EventStringMultiple Event entities can be used. If omitted, all “Created” and “Removed” events are handled. “Lifecycle” and “Synced” event types must be specified explicitly.No
FilterContainerHolding S3Key, S3Metadata and S3Tags entitiesNo
S3KeyContainerHolding a list of FilterRule entities, for filtering based on object key. At most, 3 entities may be in the list, with Name be prefix, suffix or regex. All filter rules in the list must match for the filter to match.No
S3MetadataContainerHolding a list of FilterRule entities, for filtering based on object metadata. All filter rules in the list must match the metadata defined on the object. However, the object still match if it has other metadata entries not listed in the filter.No
S3TagsContainerHolding a list of FilterRule entities, for filtering based on object tags. All filter rules in the list must match the tags defined on the object. However, the object still match it it has other tags not listed in the filter.No
S3Key.FilterRuleContainerHolding Name and Value entities. Name would be: prefix, suffix or regex. The Value would hold the key prefix, key suffix or a regular expression for matching the key, accordingly.Yes
S3Metadata.FilterRuleContainerHolding Name and Value entities. Name would be the name of the metadata attribute (e.g. x-amz-meta-xxx). The Value would be the expected value for this attribute.Yes
S3Tags.FilterRuleContainerHolding Name and Value entities. Name would be the tag key, and Value would be the tag value.Yes


HTTP Response

HTTP StatusStatus CodeDescription
400MalformedXMLThe XML is not well-formed
400InvalidArgumentMissing Id; Missing/Invalid Topic ARN; Invalid Event
404NoSuchBucketThe bucket does not exist
404NoSuchKeyThe topic does not exist

Delete Notification

Delete a specific, or all, notifications from a bucket.

Note

  • Notification deletion is an extension to the S3 notification API
  • When the bucket is deleted, any notification defined on it is also deleted
  • Deleting an unknown notification (e.g. double delete) is not considered an error

Syntax

DELETE /{bucket}?notification[=<notification-id>] HTTP/1.1

Parameters

NameTypeDescription
notification-idStringName of the notification. If not provided, all notifications on the bucket are deleted

HTTP Response

HTTP StatusStatus CodeDescription
404NoSuchBucketThe bucket does not exist

Get/List Notification

Get a specific notification, or list all notifications configured on a bucket.

Syntax

GET /{bucket}?notification[=<notification-id>] HTTP/1.1

Parameters

NameTypeDescription
notification-idStringName of the notification. If not provided, all notifications on the bucket are listed

Response Entities

Response is XML encoded in the body of the request, in the following format:

<NotificationConfiguration xmlns=”http://s3.amazonaws.com/doc/2006-03-01/”>

            <TopicConfiguration>

             <Id></Id>

             <Topic></Topic>

             <Event></Event>

             <Filter>

             <S3Key>

              <FilterRule>

                           <Name></Name>

                   <Value></Value>

              </FilterRule>

             </S3Key>

             <S3Metadata>

             <FilterRule>

                           <Name></Name>

                           <Value></Value>

             </FilterRule>

             </S3Metadata>

             <S3Tags>

             <FilterRule>

                           <Name></Name>

                           <Value></Value>

             </FilterRule>

             </S3Tags>

             </Filter>

            </TopicConfiguration>

</NotificationConfiguration>

NameTypeDescriptionRequired
NotificationConfigurationContainerHolding list of TopicConfiguration entitiesYes
TopicConfigurationContainerHolding Id, Topic and list of Event entitiesYes
IdStringName of the notificationYes
TopicStringTopic ARNYes
EventStringHandled event. Multiple Event entities may existYes
FilterContainerHolding the filters configured for this notificationNo

HTTP Response

HTTP StatusStatus CodeDescription
404NoSuchBucketThe bucket does not exist
404NoSuchKeyThe notification does not exist (if provided)

Enable Bucket Logging

Enable logging for a bucket.

Syntax

PUT /{bucket}?logging HTTP/1.1

Request Entities

Parameters are XML encoded in the body of the request, in the following format:

<BucketLoggingStatus xmlns=”http://s3.amazonaws.com/doc/2006-03-01/”>

  <LoggingEnabled>

    <TargetBucket>string</TargetBucket>

    <TargetGrants>

      <Grant>

        <Grantee>

          <DisplayName>string</DisplayName>

          <EmailAddress>string</EmailAddress>

          <ID>string</ID>

          <xsi:type>string</xsi:type>

          <URI>string</URI>

        </Grantee>

        <Permission>string</Permission>

      </Grant>

    </TargetGrants>

    <TargetObjectKeyFormat>

      <PartitionedPrefix>

        <PartitionDateSource>DeliveryTime|EventTime</PartitionDateSource>

      </PartitionedPrefix>

      <SimplePrefix>

      </SimplePrefix>

    </TargetObjectKeyFormat>

    <TargetPrefix>string</TargetPrefix>

    <LoggingType>Standard|Journal</LoggingType>

    <ObjectRollTime>integer</ObjectRollTime>

    <Filter>

      <S3Key>

        <FilterRule>

          <Name>suffix/prefix/regex</Name>

          <Value></Value>

        </FilterRule>

      </S3Key>

    </Filter>

  </LoggingEnabled>

</BucketLoggingStatus>

NameTypeDescriptionRequired
BucketLoggingStatusContainerEnabling/Disabling logging configuration for the bucket.Yes
LoggingEnabledContainerHolding the logging configuration for the bucket.Yes
TargetBucketStringThe bucket where the logs are stored. The log bucket cannot have bucket logging enabled.Yes
TargetGrantsContainerNot supported. The owner of the log bucket is the owner of the log objects.No
TargetObjectKeyFormatContainerThe format of the log object key. Contains either PartitionedPrefix or SimplePrefix entities.No
PartitionedPrefixContainerIndicates a partitioned log object key format. Note that PartitionDateSource is ignored and hardcoded as DeliveryTimeNo
SimplePrefixContainerIndicates a simple log object key format (default format)No
TargetPrefixStringThe prefix for the log objects. Used in both formats. May be used to distinguish between different source buckets writing log records to the same log bucket.No
LoggingTypeStringThe type of logging. Valid values are: Standard (default) all bucket operations are logged after being perfomed. The log record will contain all fields. Journal only PUT, COPY, MULTI/DELETE and MPU operations are logged. Will record the minimum subset of fields in the log record that is needed for journaling.No
ObjectRollTimeIntegerThe time in seconds after which a new log object is created, and the previous log object added to the log bucket. Default is 3600 seconds (1 hour).No

HTTP Response

HTTP StatusStatus CodeDescription
400MalformedXMLThe XML is not well-formed
400InvalidArgumentMissing mandatory value or invalid value
404NoSuchBucketThe bucket does not exist

Disable Bucket Logging

Disable bucket logging from a bucket.

Syntax

PUT /{bucket}?logging HTTP/1.1

Request Entities

Parameters are XML encoded in the body of the request, in the following format:

<BucketLoggingStatus xmlns=”http://s3.amazonaws.com/doc/2006-03-01/”>

</BucketLoggingStatus>

HTTP Response

HTTP StatusStatus CodeDescription
404NoSuchBucketThe bucket does not exist

Get Bucket Logging

Get logging configured on a bucket.

Syntax

GET /{bucket}?logging HTTP/1.1

Response Entities

Response is XML encoded in the body of the request, in the following format:

<BucketLoggingStatus xmlns=”http://s3.amazonaws.com/doc/2006-03-01/”>

  <LoggingEnabled>

    <TargetBucket>string</TargetBucket>

    <TargetGrants>

      <Grant>

        <Grantee>

          <DisplayName>string</DisplayName>

          <EmailAddress>string</EmailAddress>

          <ID>string</ID>

          <xsi:type>string</xsi:type>

          <URI>string</URI>

        </Grantee>

        <Permission>string</Permission>

      </Grant>

    </TargetGrants>

    <TargetObjectKeyFormat>

      <PartitionedPrefix>

        <PartitionDateSource>DeliveryTime|EventTime</PartitionDateSource>

      </PartitionedPrefix>

      <SimplePrefix>

      </SimplePrefix>

    </TargetObjectKeyFormat>

    <TargetPrefix>string</TargetPrefix>

    <LoggingType>Standard|Journal</LoggingType>

    <ObjectRollTime>integer</ObjectRollTime>

    <Filter>

      <S3Key>

        <FilterRule>

          <Name>suffix/prefix/regex</Name>

          <Value></Value>

        </FilterRule>

      </S3Key>

    </Filter>

  </LoggingEnabled>

</BucketLoggingStatus>

HTTP Response

HTTP StatusStatus CodeDescription
404NoSuchBucketThe bucket does not exist

Flush Bucket Logging

Flushes all logging objects for a given source bucket (logging bucket are written lazily).


Syntax

POST /{bucket}?logging HTTP/1.1

HTTP Response

HTTP StatusStatus CodeDescription
201CreatedFlushed all logging objects successfully
404NoSuchBucketThe bucket does not exist