Skip to content

create_bucket_metadata_configuration

create_bucket_metadata_configuration(
    bucket: BucketName,
    metadata_configuration: MetadataConfiguration,
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    content_md5: Optional[ContentMD5] = None,
    checksum_algorithm: Optional[ChecksumAlgorithm] = None,
    expected_bucket_owner: Optional[AccountId] = None,
) -> None

Creates an S3 Metadata V2 metadata configuration for a general purpose bucket. For more information, see Accelerating data discovery with S3 Metadata in the Amazon S3 User Guide.

Permissions

To use this operation, you must have the following permissions. For more information, see Setting up permissions for configuring metadata tables in the Amazon S3 User Guide.

If you want to encrypt your metadata tables with server-side encryption with Key Management Service (KMS) keys (SSE-KMS), you need additional permissions in your KMS key policy. For more information, see Setting up permissions for configuring metadata tables in the Amazon S3 User Guide.

If you also want to integrate your table bucket with Amazon Web Services analytics services so that you can query your metadata table, you need additional permissions. For more information, see Integrating Amazon S3 Tables with Amazon Web Services analytics services in the Amazon S3 User Guide.

To query your metadata tables, you need additional permissions. For more information, see Permissions for querying metadata tables in the Amazon S3 User Guide.

  • s3:CreateBucketMetadataTableConfiguration

    The IAM policy action name is the same for the V1 and V2 API operations.

  • s3tables:CreateTableBucket

  • s3tables:CreateNamespace

  • s3tables:GetTable

  • s3tables:CreateTable

  • s3tables:PutTablePolicy

  • s3tables:PutTableBucketPolicy

  • s3tables:PutTableEncryption

  • kms:DescribeKey

  • iam:PassRole - required if you include an AnnotationTableConfiguration with an IAM role.

The following operations are related to CreateBucketMetadataConfiguration:

If you include an AnnotationTableConfiguration with an IAM role, the role must have a trust policy that allows the Amazon S3 metadata service to assume it, and a permissions policy that grants the actions needed to read annotations from your bucket. The following examples show a trust policy and a permissions policy that you can adapt for your bucket and account.

You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

Parameters:

  • bucket (BucketName) –

    The general purpose bucket that you want to create the metadata configuration for.

  • content_md5 (Optional[ContentMD5], default: None ) –

    The Content-MD5 header for the metadata configuration.

  • checksum_algorithm (Optional[ChecksumAlgorithm], default: None ) –

    The checksum algorithm to use with your metadata configuration.

  • metadata_configuration (MetadataConfiguration) –

    The contents of your metadata configuration.

  • expected_bucket_owner (Optional[AccountId], default: None ) –

    The expected owner of the general purpose bucket that corresponds to your metadata configuration.

Raises:

Source code in docs_src/capo_s3/_services/s3.py
def create_bucket_metadata_configuration(
    self,
    bucket: "capo_s3.types.bucket_name.BucketName",
    metadata_configuration: "capo_s3.types.metadata_configuration.MetadataConfiguration",
    *,
    config_overrides: Optional[S3ClientConfig] = None,
    content_md5: Optional["capo_s3.types.content_md5.ContentMD5"] = None,
    checksum_algorithm: Optional[
        "capo_s3.types.checksum_algorithm.ChecksumAlgorithm"
    ] = None,
    expected_bucket_owner: Optional["capo_s3.types.account_id.AccountId"] = None,
) -> None:
    """<p>Creates an S3 Metadata V2 metadata configuration for a general purpose bucket. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-overview.html">Accelerating data discovery with S3 Metadata</a> in the <i>Amazon S3 User Guide</i>.</p> <dl> <dt>Permissions</dt> <dd> <p>To use this operation, you must have the following permissions. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-permissions.html">Setting up permissions for configuring metadata tables</a> in the <i>Amazon S3 User Guide</i>.</p> <p>If you want to encrypt your metadata tables with server-side encryption with Key Management Service (KMS) keys (SSE-KMS), you need additional permissions in your KMS key policy. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-permissions.html"> Setting up permissions for configuring metadata tables</a> in the <i>Amazon S3 User Guide</i>.</p> <p>If you also want to integrate your table bucket with Amazon Web Services analytics services so that you can query your metadata table, you need additional permissions. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-integrating-aws.html"> Integrating Amazon S3 Tables with Amazon Web Services analytics services</a> in the <i>Amazon S3 User Guide</i>.</p> <p>To query your metadata tables, you need additional permissions. For more information, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metadata-tables-bucket-query-permissions.html"> Permissions for querying metadata tables</a> in the <i>Amazon S3 User Guide</i>.</p> <ul> <li> <p> <code>s3:CreateBucketMetadataTableConfiguration</code> </p> <note> <p>The IAM policy action name is the same for the V1 and V2 API operations.</p> </note> </li> <li> <p> <code>s3tables:CreateTableBucket</code> </p> </li> <li> <p> <code>s3tables:CreateNamespace</code> </p> </li> <li> <p> <code>s3tables:GetTable</code> </p> </li> <li> <p> <code>s3tables:CreateTable</code> </p> </li> <li> <p> <code>s3tables:PutTablePolicy</code> </p> </li> <li> <p> <code>s3tables:PutTableBucketPolicy</code> </p> </li> <li> <p> <code>s3tables:PutTableEncryption</code> </p> </li> <li> <p> <code>kms:DescribeKey</code> </p> </li> <li> <p> <code>iam:PassRole</code> - required if you include an <code>AnnotationTableConfiguration</code> with an IAM role.</p> </li> </ul> </dd> </dl> <p>The following operations are related to <code>CreateBucketMetadataConfiguration</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketMetadataConfiguration.html">DeleteBucketMetadataConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketMetadataConfiguration.html">GetBucketMetadataConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataInventoryTableConfiguration.html">UpdateBucketMetadataInventoryTableConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataJournalTableConfiguration.html">UpdateBucketMetadataJournalTableConfiguration</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_UpdateBucketMetadataAnnotationTableConfiguration.html">UpdateBucketMetadataAnnotationTableConfiguration</a> </p> </li> </ul> <p>If you include an <code>AnnotationTableConfiguration</code> with an IAM role, the role must have a trust policy that allows the Amazon S3 metadata service to assume it, and a permissions policy that grants the actions needed to read annotations from your bucket. The following examples show a trust policy and a permissions policy that you can adapt for your bucket and account.</p> <important> <p>You must URL encode any signed header values that contain spaces. For example, if your header value is <code>my file.txt</code>, containing two spaces after <code>my</code>, you must URL encode this value to <code>my%20%20file.txt</code>.</p> </important>

    Args:
        bucket: <p> The general purpose bucket that you want to create the metadata configuration for. </p>
        content_md5: <p> The <code>Content-MD5</code> header for the metadata configuration. </p>
        checksum_algorithm: <p> The checksum algorithm to use with your metadata configuration. </p>
        metadata_configuration: <p> The contents of your metadata configuration. </p>
        expected_bucket_owner: <p> The expected owner of the general purpose bucket that corresponds to your metadata configuration. </p>

    Raises:
        capo_s3.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_s3.types.create_bucket_metadata_configuration_request.CreateBucketMetadataConfigurationRequest]",
    ) -> OperationResponse[None]:
        import capo_s3._operations.amazon_s3.create_bucket_metadata_configuration

        output, http_response = (
            capo_s3._operations.amazon_s3.create_bucket_metadata_configuration.create_bucket_metadata_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateBucketMetadataConfiguration")
    )
    input_: capo_s3.types.create_bucket_metadata_configuration_request.CreateBucketMetadataConfigurationRequest = {
        "bucket": bucket,
        "metadata_configuration": metadata_configuration,
    }
    if content_md5 is not None:
        input_["content_md5"] = content_md5
    if checksum_algorithm is not None:
        input_["checksum_algorithm"] = checksum_algorithm
    if expected_bucket_owner is not None:
        input_["expected_bucket_owner"] = expected_bucket_owner

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output