create_bucket(
bucket: BucketName,
*,
config_overrides: Optional[S3ControlClientConfig] = None,
acl: Optional[BucketCannedACL] = None,
create_bucket_configuration: Optional[CreateBucketConfiguration] = None,
grant_full_control: Optional[GrantFullControl] = None,
grant_read: Optional[GrantRead] = None,
grant_read_acp: Optional[GrantReadACP] = None,
grant_write: Optional[GrantWrite] = None,
grant_write_acp: Optional[GrantWriteACP] = None,
object_lock_enabled_for_bucket: Optional[ObjectLockEnabledForBucket] = None,
outpost_id: Optional[NonEmptyMaxLength64String] = None,
) -> CreateBucketResult
This action creates an Amazon S3 on Outposts bucket. To create an S3 bucket, see Create Bucket in the Amazon S3 API Reference.
Creates a new Outposts bucket. By creating the bucket, you become the bucket owner. To create an Outposts bucket, you must have S3 on Outposts. For more information, see Using Amazon S3 on Outposts in Amazon S3 User Guide.
Not every string is an acceptable bucket name. For information on bucket naming restrictions, see Working with Amazon S3 Buckets.
S3 on Outposts buckets support:
For a complete list of restrictions and Amazon S3 feature limitations on S3 on Outposts, see Amazon S3 on Outposts Restrictions and Limitations.
For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and x-amz-outpost-id in your API request, see the Examples section.
The following actions are related to CreateBucket for Amazon S3 on Outposts:
Parameters:
-
acl
(Optional[BucketCannedACL], default:
None
)
–
The canned ACL to apply to the bucket.
This is not supported by Amazon S3 on Outposts buckets.
-
bucket
(BucketName)
–
-
create_bucket_configuration
(Optional[CreateBucketConfiguration], default:
None
)
–
The configuration information for the bucket.
This is not supported by Amazon S3 on Outposts buckets.
-
grant_full_control
(Optional[GrantFullControl], default:
None
)
–
Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.
This is not supported by Amazon S3 on Outposts buckets.
-
grant_read
(Optional[GrantRead], default:
None
)
–
Allows grantee to list the objects in the bucket.
This is not supported by Amazon S3 on Outposts buckets.
-
grant_read_acp
(Optional[GrantReadACP], default:
None
)
–
Allows grantee to read the bucket ACL.
This is not supported by Amazon S3 on Outposts buckets.
-
grant_write
(Optional[GrantWrite], default:
None
)
–
Allows grantee to create, overwrite, and delete any object in the bucket.
This is not supported by Amazon S3 on Outposts buckets.
-
grant_write_acp
(Optional[GrantWriteACP], default:
None
)
–
Allows grantee to write the ACL for the applicable bucket.
This is not supported by Amazon S3 on Outposts buckets.
-
object_lock_enabled_for_bucket
(Optional[ObjectLockEnabledForBucket], default:
None
)
–
Specifies whether you want S3 Object Lock to be enabled for the new bucket.
This is not supported by Amazon S3 on Outposts buckets.
-
outpost_id
(Optional[NonEmptyMaxLength64String], default:
None
)
–
The ID of the Outposts where the bucket is being created.
This ID is required by Amazon S3 on Outposts buckets.
Raises:
-
BucketAlreadyExists
–
The requested Outposts bucket name is not available. The bucket namespace is shared by all users of the Outposts in this Region. Select a different name and try again.
-
BucketAlreadyOwnedByYou
–
The Outposts bucket you tried to create already exists, and you own it.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_s3_control/_services/s3_control.py
| def create_bucket(
self,
bucket: "capo_s3_control.types.bucket_name.BucketName",
*,
config_overrides: Optional[S3ControlClientConfig] = None,
acl: Optional["capo_s3_control.types.bucket_canned_acl.BucketCannedACL"] = None,
create_bucket_configuration: Optional[
"capo_s3_control.types.create_bucket_configuration.CreateBucketConfiguration"
] = None,
grant_full_control: Optional[
"capo_s3_control.types.grant_full_control.GrantFullControl"
] = None,
grant_read: Optional["capo_s3_control.types.grant_read.GrantRead"] = None,
grant_read_acp: Optional[
"capo_s3_control.types.grant_read_acp.GrantReadACP"
] = None,
grant_write: Optional["capo_s3_control.types.grant_write.GrantWrite"] = None,
grant_write_acp: Optional[
"capo_s3_control.types.grant_write_acp.GrantWriteACP"
] = None,
object_lock_enabled_for_bucket: Optional[
"capo_s3_control.types.object_lock_enabled_for_bucket.ObjectLockEnabledForBucket"
] = None,
outpost_id: Optional[
"capo_s3_control.types.non_empty_max_length64_string.NonEmptyMaxLength64String"
] = None,
) -> "capo_s3_control.types.create_bucket_result.CreateBucketResult":
"""<note> <p>This action creates an Amazon S3 on Outposts bucket. To create an S3 bucket, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html">Create Bucket</a> in the <i>Amazon S3 API Reference</i>. </p> </note> <p>Creates a new Outposts bucket. By creating the bucket, you become the bucket owner. To create an Outposts bucket, you must have S3 on Outposts. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">Using Amazon S3 on Outposts</a> in <i>Amazon S3 User Guide</i>.</p> <p>Not every string is an acceptable bucket name. For information on bucket naming restrictions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/BucketRestrictions.html#bucketnamingrules">Working with Amazon S3 Buckets</a>.</p> <p>S3 on Outposts buckets support:</p> <ul> <li> <p>Tags</p> </li> <li> <p>LifecycleConfigurations for deleting expired objects</p> </li> </ul> <p>For a complete list of restrictions and Amazon S3 feature limitations on S3 on Outposts, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OnOutpostsRestrictionsLimitations.html"> Amazon S3 on Outposts Restrictions and Limitations</a>.</p> <p>For an example of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and <code>x-amz-outpost-id</code> in your API request, see the <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateBucket.html#API_control_CreateBucket_Examples">Examples</a> section.</p> <p>The following actions are related to <code>CreateBucket</code> for Amazon S3 on Outposts:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html">PutObject</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucket.html">GetBucket</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucket.html">DeleteBucket</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html">CreateAccessPoint</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html">PutAccessPointPolicy</a> </p> </li> </ul>
Args:
acl: <p>The canned ACL to apply to the bucket.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
bucket: <p>The name of the bucket.</p>
create_bucket_configuration: <p>The configuration information for the bucket.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
grant_full_control: <p>Allows grantee the read, write, read ACP, and write ACP permissions on the bucket.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
grant_read: <p>Allows grantee to list the objects in the bucket.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
grant_read_acp: <p>Allows grantee to read the bucket ACL.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
grant_write: <p>Allows grantee to create, overwrite, and delete any object in the bucket.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
grant_write_acp: <p>Allows grantee to write the ACL for the applicable bucket.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
object_lock_enabled_for_bucket: <p>Specifies whether you want S3 Object Lock to be enabled for the new bucket.</p> <note> <p>This is not supported by Amazon S3 on Outposts buckets.</p> </note>
outpost_id: <p>The ID of the Outposts where the bucket is being created.</p> <note> <p>This ID is required by Amazon S3 on Outposts buckets.</p> </note>
Raises:
capo_s3_control.errors.bucket_already_exists.BucketAlreadyExists: <p>The requested Outposts bucket name is not available. The bucket namespace is shared by all users of the Outposts in this Region. Select a different name and try again.</p>
capo_s3_control.errors.bucket_already_owned_by_you.BucketAlreadyOwnedByYou: <p>The Outposts bucket you tried to create already exists, and you own it. </p>
capo_s3_control.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_s3_control.types.create_bucket_request.CreateBucketRequest]",
) -> OperationResponse[
"capo_s3_control.types.create_bucket_result.CreateBucketResult"
]:
import capo_s3_control._operations.awss3_control_service_v20180820.create_bucket
output, http_response = (
capo_s3_control._operations.awss3_control_service_v20180820.create_bucket.create_bucket(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateBucket")
)
input_: capo_s3_control.types.create_bucket_request.CreateBucketRequest = {
"bucket": bucket
}
if acl is not None:
input_["acl"] = acl
if create_bucket_configuration is not None:
input_["create_bucket_configuration"] = create_bucket_configuration
if grant_full_control is not None:
input_["grant_full_control"] = grant_full_control
if grant_read is not None:
input_["grant_read"] = grant_read
if grant_read_acp is not None:
input_["grant_read_acp"] = grant_read_acp
if grant_write is not None:
input_["grant_write"] = grant_write
if grant_write_acp is not None:
input_["grant_write_acp"] = grant_write_acp
if object_lock_enabled_for_bucket is not None:
input_["object_lock_enabled_for_bucket"] = object_lock_enabled_for_bucket
if outpost_id is not None:
input_["outpost_id"] = outpost_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|