CreateBucket (Cloud Storage)
CreateBucket - Amazon Simple Storage Service
Supported headers and XML elements
✅Supported Headers
x-amz-acl
private
public-read
✅Supported XML Element
LocationConstraint
Example request
PUT /mybucket HTTP/1.1
Host: [region].telnyxstorage.com
Accept: text/xml
x-amz-acl: private
Content-Type: application/xml
X-Amz-Content-Sha256: beaead3198f7da1e70d03ab969765e0821b24fc913697e929e726aeaebf0eba3
X-Amz-Date: 20230927T152207Z
Authorization: AWS4-HMAC-SHA256 Credential=YOUR_TELNYX_API_KEY/20230927/test/execute-api/aws4_request, SignedHeaders=accept;content-length;content-type;host;x-amz-acl;x-amz-content-sha256;x-amz-date, Signature=eb67629c5cd507c56c5c5447323cc0190c605ab87c2b2fd3046825ca09a28425
Content-Length: 197
<?xml version="1.0" encoding="UTF-8"?>
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LocationConstraint>us-east-1</LocationConstraint>
</CreateBucketConfiguration>
Bucket’s location is inherited from the regional endpoint to which you sent the CreateBucket request. If LocationConstraint is specified in the request body, its value must match that of the location in the regional endpoint. Otherwise, an error will be returned.
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>InvalidLocationConstraint</Code>
<Message>The specified location-constraint is not valid</Message>
<BucketName>mybucket</BucketName>
<RequestId>tx00000e9df2217c8f5a351-00651445e0-e3e7-fl1</RequestId>
<HostId>e3e7-fl1-us-east-1</HostId>
</Error>
In general, bucket names should follow domain name constraints.
Bucket names
- must be unique.
- cannot be formatted as IP address.
- can be between 3 and 63 characters long.
- must not contain uppercase characters or underscores.
- must start with a lowercase letter or number.
- can contain a dash (-).
- 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.
Otherwise the following error will be returned
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>InvalidBucketName</Code>
<BucketName>invalidBucket</BucketName>
<RequestId>tx0000040523d3a2d1ba956-006514716b-e3a0-fl1</RequestId>
<HostId>e3a0-fl1-us-east-1</HostId>
</Error>