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
S3TablesDestinationConfigurationis 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
S3DestinationConfigurationis 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
ACTIVEstate. -
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
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | |