Menu
Amazon Simple Storage Service
API Reference (API Version 2006-03-01)

PUT Bucket

Description

This implementation of the PUT operation creates a new bucket. To create a bucket, you must register with Amazon S3 and have a valid AWS Access Key ID to authenticate requests. Anonymous requests are never allowed to create buckets. By creating the bucket, you become the bucket owner.

Not every string is an acceptable bucket name. For information on bucket naming restrictions, see Working with Amazon S3 Buckets.

By default, the bucket is created in the US East (N. Virginia) region. You can optionally specify a region in the request body. You might choose a region to optimize latency, minimize costs, or address regulatory requirements. For example, if you reside in Europe, you will probably find it advantageous to create buckets in the EU (Ireland) region. For more information, see How to Select a Region for Your Buckets.

Note

If you create a bucket in a region other than US East (N. Virginia) region, your application must be able to handle 307 redirect. For more information, go to Virtual Hosting of Buckets in Amazon Simple Storage Service Developer Guide.

When creating a bucket using this operation, you can optionally specify the accounts or groups that should be granted specific permissions on the bucket. There are two ways to grant the appropriate permissions using the request headers.

  • Specify a canned ACL using the x-amz-acl request header. For more information, see Canned ACL in the Amazon Simple Storage Service Developer Guide.

  • Specify access permissions explicitly using the x-amz-grant-read, x-amz-grant-write, x-amz-grant-read-acp, x-amz-grant-write-acp, x-amz-grant-full-control headers. These headers map to the set of permissions Amazon S3 supports in an ACL. For more information, go to Access Control List (ACL) Overview in the Amazon Simple Storage Service Developer Guide.

Note

You can use either a canned ACL or specify access permissions explicitly. You cannot do both.

Requests

Syntax

PUT / HTTP/1.1
Host: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
		4))

<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> 
  <LocationConstraint>BucketRegion</LocationConstraint> 
  </CreateBucketConfiguration>

Note

The syntax shows some of the request headers. For a complete list, see the Request Headers section.

Note

If you send your create bucket request to the s3.amazonaws.com endpoint, the request go to the us-east-1 region. Accordingly, the signature calculations in Signature Version 4 must use us-east-1 as region, even if the location constraint in the request specifies another region where the bucket is to be created.

Request Parameters

This implementation of the operation does not use request parameters.

Request Headers

This implementation of the operation can use the following request headers in addition to the request headers common to all operations. Request headers are limited to 8 KB in size. For more information, see Common Request Headers.

When creating a bucket, you can grant permissions to individual AWS accounts or predefined groups defined by Amazon S3. This results in creation of the Access Control List (ACL) on the bucket. For more information, see Using ACLs. You have the following two ways to grant these permissions:

  • Specify a canned ACL — Amazon S3 supports a set of predefined ACLs, known as canned ACLs. Each canned ACL has a predefined set of grantees and permissions. For more information, go to Canned ACL.

    Name Description Required
    x-amz-acl

    The canned ACL to apply to the bucket you are creating. For more information, go to Canned ACL in the Amazon Simple Storage Service Developer Guide.

    Type: String

    Valid Values: private | public-read | public-read-write | aws-exec-read | authenticated-read | bucket-owner-read | bucket-owner-full-control

    No

  • Specify access permissions explicitly — If you want to explicitly grant access permissions to specific AWS accounts or groups, you use the following headers. Each of these headers maps to specific permissions Amazon S3 supports in an ACL. For more information, go to Access Control List (ACL) Overview. In the header value, you specify a list of grantees who get the specific permission

    Name Description Required
    x-amz-grant-read

    Allows grantee to list the objects in the bucket.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-write

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

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-read-acp

    Allows grantee to read the bucket ACL.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-write-acp

    Allows grantee to write the ACL for the applicable bucket.

    Type: String

    Default: None

    Constraints: None

    No
    x-amz-grant-full-control

    Allows grantee the READ, WRITE, READ_ACP, and WRITE_ACP permissions on the bucket.

    Type: String

    Default: None

    Constraints: None

    No

You specify each grantee as a type=value pair, where the type can be one of the following::

  • emailAddress — if value specified is the email address of an AWS account

  • id — if value specified is the canonical user ID of an AWS account

  • uri — if granting permission to a predefined group.

For example, the following x-amz-grant-read header grants list objects permission to the AWS accounts identified by their email addresses.

x-amz-grant-read: emailAddress="xyz@amazon.com", emailAddress="abc@amazon.com"

For more information see, ACL Overview.

Request Elements

Name Description Required
CreateBucketConfiguration

Container for bucket configuration settings.

Type: Container

Ancestor: None

No
LocationConstraint

Specifies the region where the bucket will be created. If you are creating a bucket on the US East (N. Virginia) region (us-east-1), you do not need to specify the location constraint. For more information about region endpoints and location constraints, go to Regions and Endpoints in the AWS General Reference.

Type: Enum

Valid Values: [ us-west-1 | us-west-2 | EU or eu-west-1 | eu-central-1 | ap-south-1 | ap-southeast-1 | ap-southeast-2 | ap-northeast-1 | ap-northeast-2 | sa-east-1 ]

Default: US East (N. Virginia) region

Ancestor: CreateBucketConfiguration

No

Response Elements

This implementation of the operation does not return response elements.

Special Errors

This implementation of the operation does not return special errors. For general information about Amazon S3 errors and a list of error codes, see Error Responses.

Examples

Sample Request

This request creates a bucket named colorpictures.

PUT / HTTP/1.1
Host: colorpictures.s3.amazonaws.com
Content-Length: 0
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: authorization string

Sample Response

HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar  2006 12:00:00 GMT

Location: /colorpictures
Content-Length: 0
Connection: close
Server: AmazonS3

Sample Request: Setting the region of a bucket

The following request sets the region the bucket to EU.

PUT / HTTP/1.1
Host: bucketName.s3.amazonaws.com
Date: Wed, 12 Oct 2009 17:50:00 GMT
Authorization: authorization string
Content-Type: text/plain
Content-Length: 124

<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> 
  <LocationConstraint>EU</LocationConstraint> 
</CreateBucketConfiguration >
			

Sample Response

Sample Request: Creating a bucket and configuring access permission using a canned ACL

This request creates a bucket named "colorpictures" and sets the ACL to private.

PUT / HTTP/1.1
Host: colorpictures.s3.amazonaws.com
Content-Length: 0
x-amz-acl: private
Date: Wed, 01 Mar  2006 12:00:00 GMT
Authorization: authorization string

Sample Response

HTTP/1.1 200 OK
x-amz-id-2: YgIPIfBiKa2bj0KMg95r/0zo3emzU4dzsD4rcKCHQUAdQkf3ShJTOOpXUueF6QKo
x-amz-request-id: 236A8905248E5A01
Date: Wed, 01 Mar  2006 12:00:00 GMT

Location: /colorpictures
Content-Length: 0
Connection: close
Server: AmazonS3

Sample Request: Creating a bucket and configuring access permissions explicitly

This request creates a bucket named colorpictures and grants WRITE permission to the AWS account identified by an email address.

PUT HTTP/1.1
Host: colorpictures.s3.amazonaws.com
x-amz-date: Sat, 07 Apr 2012 00:54:40 GMT
Authorization: authorization string
x-amz-grant-write: emailAddress="xyz@amazon.com", emailAddress="abc@amazon.com"

Sample Response

HTTP/1.1 200 OK