Skip to content

create_channel

create_channel(
    channel_name: ChannelName,
    service_execution_role_arn: RoleARN,
    stream_configuration_list: ChannelStreamConfigurationList,
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    s3_destination_configuration: Optional[S3DestinationConfiguration] = None,
    s3_tables_destination_configuration: Optional[
        S3TablesDestinationConfiguration
    ] = None,
    encryption_configuration: Optional[ChannelEncryptionConfiguration] = None,
    tags: Optional[TagMap] = None,
    logging_configuration: Optional[ChannelLoggingConfiguration] = None,
) -> CreateChannelOutput

Creates a channel that delivers records from a Kinesis data stream to a destination. A channel reads records from the specified stream and writes them to streaming tables on Apache Iceberg (Amazon S3 Tables) or to a general purpose Amazon S3 bucket.

You must specify either S3DestinationConfiguration or S3TablesDestinationConfiguration, but not both.

To use this operation, you must have permission to pass the specified service execution IAM role to Amazon Kinesis Data Streams (the iam:PassRole permission on that role).

Creating a channel is an asynchronous operation. Upon receiving the request, Amazon Kinesis Data Streams returns immediately with the channel in the CREATING state. After provisioning is complete, Amazon Kinesis Data Streams sets the state to ACTIVE. You can use DescribeChannel to check the current state.

This operation is only supported for data streams with the on-demand capacity mode.

This operation has a call limit of 5 transactions per second (TPS) for each Amazon Web Services account. Exceeding 5 TPS results in a LimitExceededException.

Parameters:

  • channel_name (ChannelName) –

    The name of the channel. The name is unique within your Amazon Web Services account and Amazon Web Services Region.

  • service_execution_role_arn (RoleARN) –

    The Amazon Resource Name (ARN) of the IAM role that Amazon Kinesis Data Streams assumes to write records to the destination.

  • stream_configuration_list (ChannelStreamConfigurationList) –

    The source stream configuration for the channel. Currently, one stream is supported per channel.

  • s3_destination_configuration (Optional[S3DestinationConfiguration], default: None ) –

    The configuration for delivery to a general purpose Amazon S3 bucket. Specify this parameter when S3TablesDestinationConfiguration is not specified.

  • s3_tables_destination_configuration (Optional[S3TablesDestinationConfiguration], default: None ) –

    The configuration for delivery to streaming tables on Apache Iceberg in Amazon S3 Tables. Specify this parameter when S3DestinationConfiguration is not specified.

  • encryption_configuration (Optional[ChannelEncryptionConfiguration], default: None ) –

    The server-side encryption configuration that uses an Amazon Web Services KMS key to encrypt data delivered to the destination.

  • tags (Optional[TagMap], default: None ) –

    A set of key-value pairs to assign to the channel. A tag consists of a required key and an optional value.

  • logging_configuration (Optional[ChannelLoggingConfiguration], default: None ) –

    The Amazon CloudWatch Logs configuration for the channel.

Raises:

  • AccessDeniedException –

    Specifies that you do not have the permissions required to perform this operation.

  • InvalidArgumentException –

    A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.

  • KMSAccessDeniedException –

    The ciphertext references a key that doesn't exist or that you don't have access to.

  • KMSDisabledException –

    The request was rejected because the specified customer master key (CMK) isn't enabled.

  • KMSInvalidStateException –

    The request was rejected because the state of the specified resource isn't valid for this request. For more information, see How Key State Affects Use of a Customer Master Key in the Amazon Web Services Key Management Service Developer Guide.

  • KMSNotFoundException –

    The request was rejected because the specified entity or resource can't be found.

  • KMSOptInRequired –

    The Amazon Web Services access key ID needs a subscription for the service.

  • KMSThrottlingException –

    The request was denied due to request throttling. For more information about throttling, see Limits in the Amazon Web Services Key Management Service Developer Guide.

  • LimitExceededException –

    The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed.

  • ResourceInUseException –

    The resource is not available for this operation. For successful operation, the resource must be in the ACTIVE state.

  • ResourceNotFoundException –

    The requested resource could not be found. The stream might not be specified correctly.

  • ValidationException –

    Specifies that you tried to invoke this API for a data stream with the on-demand capacity mode. This API is only supported for data streams with the provisioned capacity mode.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To create an S3 channel

>>> client.create_channel(channel_name='my-channel-name', service_execution_role_arn='arn:aws:iam::123456789012:role/my-channel-role', stream_configuration_list=[{'StreamARN': 'arn:aws:kinesis:us-east-1:123456789012:stream/my-stream-name', 'RecordConfiguration': {'RecordFormatType': 'JSON'}}], s3_destination_configuration={'StorageConfiguration': {'BucketARN': 'arn:aws:s3:::my-channel-bucket', 'ExpectedBucketOwner': '123456789012', 'CompressionType': 'ZSTD'}, 'DeadLetterQueueS3Configuration': {'BucketARN': 'arn:aws:s3:::my-channel-dlq-bucket', 'ExpectedBucketOwner': '123456789012'}}, encryption_configuration={'EncryptionType': 'KMS', 'KeyId': 'arn:aws:kms:us-east-1:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab'}, logging_configuration={'CloudWatchLogs': {'Enabled': True, 'LogGroupName': '/aws/kinesis/my-channel', 'LogStreamName': 'my-channel-log-stream'}})
To create an S3 Tables channel
>>> client.create_channel(channel_name='my-channel-name', service_execution_role_arn='arn:aws:iam::123456789012:role/my-channel-role', stream_configuration_list=[{'StreamARN': 'arn:aws:kinesis:us-east-1:123456789012:stream/my-stream-name', 'RecordConfiguration': {'RecordFormatType': 'JSON', 'GSRSchemaARN': 'arn:aws:glue:us-east-1:123456789012:schema/my-registry/my-schema'}}], s3_tables_destination_configuration={'DeadLetterQueueS3Configuration': {'BucketARN': 'arn:aws:s3:::my-channel-dlq-bucket', 'ExpectedBucketOwner': '123456789012'}, 'S3TablesConfigurationList': [{'TableBucketARN': 'arn:aws:s3tables:us-east-1:123456789012:bucket/my-table-bucket', 'Namespace': 'my_namespace', 'TableName': 'my_table', 'CompressionType': 'ZSTD', 'PartitionSpec': {'PartitionFields': [{'Transform': 'TIME_HOUR', 'SourceName': 'creation_ts'}]}}]}, encryption_configuration={'EncryptionType': 'KMS', 'KeyId': 'arn:aws:kms:us-east-1:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab'}, logging_configuration={'CloudWatchLogs': {'Enabled': True, 'LogGroupName': '/aws/kinesis/my-channel', 'LogStreamName': 'my-channel-log-stream'}})
Source code in docs_src/capo_kinesis/_services/kinesis.py
def create_channel(
    self,
    channel_name: "capo_kinesis.types.channel_name.ChannelName",
    service_execution_role_arn: "capo_kinesis.types.role_arn.RoleARN",
    stream_configuration_list: "capo_kinesis.types.channel_stream_configuration_list.ChannelStreamConfigurationList",
    *,
    config_overrides: Optional[KinesisClientConfig] = None,
    s3_destination_configuration: Optional[
        "capo_kinesis.types.s3_destination_configuration.S3DestinationConfiguration"
    ] = None,
    s3_tables_destination_configuration: Optional[
        "capo_kinesis.types.s3_tables_destination_configuration.S3TablesDestinationConfiguration"
    ] = None,
    encryption_configuration: Optional[
        "capo_kinesis.types.channel_encryption_configuration.ChannelEncryptionConfiguration"
    ] = None,
    tags: Optional["capo_kinesis.types.tag_map.TagMap"] = None,
    logging_configuration: Optional[
        "capo_kinesis.types.channel_logging_configuration.ChannelLoggingConfiguration"
    ] = None,
) -> "capo_kinesis.types.create_channel_output.CreateChannelOutput":
    """<p>Creates a channel that delivers records from a Kinesis data stream to a destination. A channel reads records from the specified stream and writes them to streaming tables on Apache Iceberg (Amazon S3 Tables) or to a general purpose Amazon S3 bucket.</p> <p>You must specify either <code>S3DestinationConfiguration</code> or <code>S3TablesDestinationConfiguration</code>, but not both.</p> <p>To use this operation, you must have permission to pass the specified service execution IAM role to Amazon Kinesis Data Streams (the <code>iam:PassRole</code> permission on that role).</p> <p>Creating a channel is an asynchronous operation. Upon receiving the request, Amazon Kinesis Data Streams returns immediately with the channel in the <code>CREATING</code> state. After provisioning is complete, Amazon Kinesis Data Streams sets the state to <code>ACTIVE</code>. You can use <a>DescribeChannel</a> to check the current state.</p> <p>This operation is only supported for data streams with the on-demand capacity mode.</p> <p>This operation has a call limit of 5 transactions per second (TPS) for each Amazon Web Services account. Exceeding 5 TPS results in a <code>LimitExceededException</code>.</p>

    Args:
        channel_name: <p>The name of the channel. The name is unique within your Amazon Web Services account and Amazon Web Services Region.</p>
        service_execution_role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that Amazon Kinesis Data Streams assumes to write records to the destination.</p>
        stream_configuration_list: <p>The source stream configuration for the channel. Currently, one stream is supported per channel.</p>
        s3_destination_configuration: <p>The configuration for delivery to a general purpose Amazon S3 bucket. Specify this parameter when <code>S3TablesDestinationConfiguration</code> is not specified.</p>
        s3_tables_destination_configuration: <p>The configuration for delivery to streaming tables on Apache Iceberg in Amazon S3 Tables. Specify this parameter when <code>S3DestinationConfiguration</code> is not specified.</p>
        encryption_configuration: <p>The server-side encryption configuration that uses an Amazon Web Services KMS key to encrypt data delivered to the destination.</p>
        tags: <p>A set of key-value pairs to assign to the channel. A tag consists of a required key and an optional value.</p>
        logging_configuration: <p>The Amazon CloudWatch Logs configuration for the channel.</p>

    Raises:
        capo_kinesis.errors.access_denied_exception.AccessDeniedException: <p>Specifies that you do not have the permissions required to perform this operation.</p>
        capo_kinesis.errors.invalid_argument_exception.InvalidArgumentException: <p>A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.</p>
        capo_kinesis.errors.kms_access_denied_exception.KMSAccessDeniedException: <p>The ciphertext references a key that doesn't exist or that you don't have access to.</p>
        capo_kinesis.errors.kms_disabled_exception.KMSDisabledException: <p>The request was rejected because the specified customer master key (CMK) isn't enabled.</p>
        capo_kinesis.errors.kms_invalid_state_exception.KMSInvalidStateException: <p>The request was rejected because the state of the specified resource isn't valid for this request. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/key-state.html">How Key State Affects Use of a Customer Master Key</a> in the <i>Amazon Web Services Key Management Service Developer Guide</i>.</p>
        capo_kinesis.errors.kms_not_found_exception.KMSNotFoundException: <p>The request was rejected because the specified entity or resource can't be found.</p>
        capo_kinesis.errors.kms_opt_in_required.KMSOptInRequired: <p>The Amazon Web Services access key ID needs a subscription for the service.</p>
        capo_kinesis.errors.kms_throttling_exception.KMSThrottlingException: <p>The request was denied due to request throttling. For more information about throttling, see <a href="https://docs.aws.amazon.com/kms/latest/developerguide/limits.html#requests-per-second">Limits</a> in the <i>Amazon Web Services Key Management Service Developer Guide</i>.</p>
        capo_kinesis.errors.limit_exceeded_exception.LimitExceededException: <p>The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed. </p>
        capo_kinesis.errors.resource_in_use_exception.ResourceInUseException: <p>The resource is not available for this operation. For successful operation, the resource must be in the <code>ACTIVE</code> state.</p>
        capo_kinesis.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found. The stream might not be specified correctly.</p>
        capo_kinesis.errors.validation_exception.ValidationException: <p>Specifies that you tried to invoke this API for a data stream with the on-demand capacity mode. This API is only supported for data streams with the provisioned capacity mode. </p>
        capo_kinesis.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create an S3 channel

        >>> client.create_channel(channel_name='my-channel-name', service_execution_role_arn='arn:aws:iam::123456789012:role/my-channel-role', stream_configuration_list=[{'StreamARN': 'arn:aws:kinesis:us-east-1:123456789012:stream/my-stream-name', 'RecordConfiguration': {'RecordFormatType': 'JSON'}}], s3_destination_configuration={'StorageConfiguration': {'BucketARN': 'arn:aws:s3:::my-channel-bucket', 'ExpectedBucketOwner': '123456789012', 'CompressionType': 'ZSTD'}, 'DeadLetterQueueS3Configuration': {'BucketARN': 'arn:aws:s3:::my-channel-dlq-bucket', 'ExpectedBucketOwner': '123456789012'}}, encryption_configuration={'EncryptionType': 'KMS', 'KeyId': 'arn:aws:kms:us-east-1:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab'}, logging_configuration={'CloudWatchLogs': {'Enabled': True, 'LogGroupName': '/aws/kinesis/my-channel', 'LogStreamName': 'my-channel-log-stream'}})
        To create an S3 Tables channel

        >>> client.create_channel(channel_name='my-channel-name', service_execution_role_arn='arn:aws:iam::123456789012:role/my-channel-role', stream_configuration_list=[{'StreamARN': 'arn:aws:kinesis:us-east-1:123456789012:stream/my-stream-name', 'RecordConfiguration': {'RecordFormatType': 'JSON', 'GSRSchemaARN': 'arn:aws:glue:us-east-1:123456789012:schema/my-registry/my-schema'}}], s3_tables_destination_configuration={'DeadLetterQueueS3Configuration': {'BucketARN': 'arn:aws:s3:::my-channel-dlq-bucket', 'ExpectedBucketOwner': '123456789012'}, 'S3TablesConfigurationList': [{'TableBucketARN': 'arn:aws:s3tables:us-east-1:123456789012:bucket/my-table-bucket', 'Namespace': 'my_namespace', 'TableName': 'my_table', 'CompressionType': 'ZSTD', 'PartitionSpec': {'PartitionFields': [{'Transform': 'TIME_HOUR', 'SourceName': 'creation_ts'}]}}]}, encryption_configuration={'EncryptionType': 'KMS', 'KeyId': 'arn:aws:kms:us-east-1:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab'}, logging_configuration={'CloudWatchLogs': {'Enabled': True, 'LogGroupName': '/aws/kinesis/my-channel', 'LogStreamName': 'my-channel-log-stream'}})
    """

    def _handler(
        req: "OperationRequest[capo_kinesis.types.create_channel_input.CreateChannelInput]",
    ) -> OperationResponse[
        "capo_kinesis.types.create_channel_output.CreateChannelOutput"
    ]:
        import capo_kinesis._operations.kinesis_20131202.create_channel

        output, http_response = (
            capo_kinesis._operations.kinesis_20131202.create_channel.create_channel(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateChannel")
    )
    input_: capo_kinesis.types.create_channel_input.CreateChannelInput = {
        "channel_name": channel_name,
        "service_execution_role_arn": service_execution_role_arn,
        "stream_configuration_list": stream_configuration_list,
    }
    if s3_destination_configuration is not None:
        input_["s3_destination_configuration"] = s3_destination_configuration
    if s3_tables_destination_configuration is not None:
        input_["s3_tables_destination_configuration"] = (
            s3_tables_destination_configuration
        )
    if encryption_configuration is not None:
        input_["encryption_configuration"] = encryption_configuration
    if tags is not None:
        input_["tags"] = tags
    if logging_configuration is not None:
        input_["logging_configuration"] = logging_configuration

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