Creates a Firehose stream.
By default, you can create up to 5,000 Firehose streams per Amazon Web Services Region.
This is an asynchronous operation that immediately returns. The initial status of the Firehose stream is CREATING. After the Firehose stream is created, its status is ACTIVE and it now accepts data. If the Firehose stream creation fails, the status transitions to CREATING_FAILED. Attempts to send data to a delivery stream that is not in the ACTIVE state cause an exception. To check the state of a Firehose stream, use DescribeDeliveryStream.
If the status of a Firehose stream is CREATING_FAILED, this status doesn't change, and you can't invoke CreateDeliveryStream again on it. However, you can invoke the DeleteDeliveryStream operation to delete it.
A Firehose stream can be configured to receive records directly from providers using PutRecord or PutRecordBatch, or it can be configured to use an existing Kinesis stream as its source. To specify a Kinesis data stream as input, set the DeliveryStreamType parameter to KinesisStreamAsSource, and provide the Kinesis stream Amazon Resource Name (ARN) and role ARN in the KinesisStreamSourceConfiguration parameter.
To create a Firehose stream with server-side encryption (SSE) enabled, include DeliveryStreamEncryptionConfigurationInput in your request. This is optional. You can also invoke StartDeliveryStreamEncryption to turn on SSE for an existing Firehose stream that doesn't have SSE enabled.
A Firehose stream is configured with a single destination, such as Amazon Simple Storage Service (Amazon S3), Amazon Redshift, Amazon OpenSearch Service, Amazon OpenSearch Serverless, Splunk, and any custom HTTP endpoint or HTTP endpoints owned by or supported by third-party service providers, including Datadog, Dynatrace, LogicMonitor, MongoDB, New Relic, and Sumo Logic. You must specify only one of the following destination configuration parameters: ExtendedS3DestinationConfiguration, S3DestinationConfiguration, ElasticsearchDestinationConfiguration, RedshiftDestinationConfiguration, or SplunkDestinationConfiguration.
When you specify S3DestinationConfiguration, you can also provide the following optional values: BufferingHints, EncryptionConfiguration, and CompressionFormat. By default, if no BufferingHints value is provided, Firehose buffers data up to 5 MB or for 5 minutes, whichever condition is satisfied first. BufferingHints is a hint, so there are some cases where the service cannot adhere to these conditions strictly. For example, record boundaries might be such that the size is a little over or under the configured buffering size. By default, no encryption is performed. We strongly recommend that you enable encryption to ensure secure data storage in Amazon S3.
A few notes about Amazon Redshift as a destination:
-
An Amazon Redshift destination requires an S3 bucket as intermediate location. Firehose first delivers data to Amazon S3 and then uses COPY syntax to load data into an Amazon Redshift table. This is specified in the RedshiftDestinationConfiguration.S3Configuration parameter.
-
The compression formats SNAPPY or ZIP cannot be specified in RedshiftDestinationConfiguration.S3Configuration because the Amazon Redshift COPY operation that reads from the S3 bucket doesn't support these compression formats.
-
We strongly recommend that you use the user name and password you provide exclusively with Firehose, and that the permissions for the account are restricted for Amazon Redshift INSERT permissions.
Firehose assumes the IAM role that is configured as part of the destination. The role should allow the Firehose principal to assume the role, and the role should have permissions that allow the service to deliver the data. For more information, see Grant Firehose Access to an Amazon S3 Destination in the Amazon Firehose Developer Guide.
Parameters:
-
delivery_stream_name
(DeliveryStreamName)
–
The name of the Firehose stream. This name must be unique per Amazon Web Services account in the same Amazon Web Services Region. If the Firehose streams are in different accounts or different Regions, you can have multiple Firehose streams with the same name.
-
delivery_stream_type
(Optional[DeliveryStreamType], default:
None
)
–
The Firehose stream type. This parameter can be one of the following values:
-
direct_put_source_configuration
(Optional[DirectPutSourceConfiguration], default:
None
)
–
The structure that configures parameters such as ThroughputHintInMBs for a stream configured with Direct PUT as a source.
-
kinesis_stream_source_configuration
(Optional[KinesisStreamSourceConfiguration], default:
None
)
–
When a Kinesis data stream is used as the source for the Firehose stream, a KinesisStreamSourceConfiguration containing the Kinesis data stream Amazon Resource Name (ARN) and the role ARN for the source stream.
-
delivery_stream_encryption_configuration_input
(Optional[DeliveryStreamEncryptionConfigurationInput], default:
None
)
–
Used to specify the type and Amazon Resource Name (ARN) of the KMS key needed for Server-Side Encryption (SSE).
-
s3_destination_configuration
(Optional[S3DestinationConfiguration], default:
None
)
–
[Deprecated] The destination in Amazon S3. You can specify only one destination.
-
extended_s3_destination_configuration
(Optional[ExtendedS3DestinationConfiguration], default:
None
)
–
The destination in Amazon S3. You can specify only one destination.
-
redshift_destination_configuration
(Optional[RedshiftDestinationConfiguration], default:
None
)
–
The destination in Amazon Redshift. You can specify only one destination.
-
elasticsearch_destination_configuration
(Optional[ElasticsearchDestinationConfiguration], default:
None
)
–
The destination in Amazon OpenSearch Service. You can specify only one destination.
-
amazonopensearchservice_destination_configuration
(Optional[AmazonopensearchserviceDestinationConfiguration], default:
None
)
–
The destination in Amazon OpenSearch Service. You can specify only one destination.
-
splunk_destination_configuration
(Optional[SplunkDestinationConfiguration], default:
None
)
–
The destination in Splunk. You can specify only one destination.
-
http_endpoint_destination_configuration
(Optional[HttpEndpointDestinationConfiguration], default:
None
)
–
Enables configuring Kinesis Firehose to deliver data to any HTTP endpoint destination. You can specify only one destination.
-
tags
(Optional[TagDeliveryStreamInputTagList], default:
None
)
–
A set of tags to assign to the Firehose stream. A tag is a key-value pair that you can define and assign to Amazon Web Services resources. Tags are metadata. For example, you can add friendly names and descriptions or other types of information that can help you distinguish the Firehose stream. For more information about tags, see Using Cost Allocation Tags in the Amazon Web Services Billing and Cost Management User Guide.
You can specify up to 50 tags when creating a Firehose stream.
If you specify tags in the CreateDeliveryStream action, Amazon Data Firehose performs an additional authorization on the firehose:TagDeliveryStream action to verify if users have permissions to create tags. If you do not provide this permission, requests to create new Firehose streams with IAM resource tags will fail with an AccessDeniedException such as following.
AccessDeniedException
User: arn:aws:sts::x:assumed-role/x/x is not authorized to perform: firehose:TagDeliveryStream on resource: arn:aws:firehose:us-east-1:x:deliverystream/x with an explicit deny in an identity-based policy.
For an example IAM policy, see Tag example.
-
amazon_open_search_serverless_destination_configuration
(Optional[AmazonOpenSearchServerlessDestinationConfiguration], default:
None
)
–
The destination in the Serverless offering for Amazon OpenSearch Service. You can specify only one destination.
-
snowflake_destination_configuration
(Optional[SnowflakeDestinationConfiguration], default:
None
)
–
Configure Snowflake destination
-
iceberg_destination_configuration
(Optional[IcebergDestinationConfiguration], default:
None
)
–
Configure Apache Iceberg Tables destination.
-
database_source_configuration
(Optional[DatabaseSourceConfiguration], default:
None
)
–
The top level object for configuring streams with database as a source.
Amazon Data Firehose is in preview release and is subject to change.
Raises:
-
InvalidArgumentException
–
The specified input parameter has a value that is not valid.
-
InvalidKMSResourceException
–
Firehose throws this exception when an attempt to put records or to start or stop Firehose stream encryption fails. This happens when the KMS service throws one of the following exception types: AccessDeniedException, InvalidStateException, DisabledException, or NotFoundException.
-
LimitExceededException
–
You have already reached the limit for a requested resource.
-
ResourceInUseException
–
The resource is already in use and not available for this operation.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_firehose/_services/async_firehose.py
| async def create_delivery_stream(
self,
delivery_stream_name: "capo_firehose.types.delivery_stream_name.DeliveryStreamName",
*,
config_overrides: Optional[AsyncFirehoseClientConfig] = None,
delivery_stream_type: Optional[
"capo_firehose.types.delivery_stream_type.DeliveryStreamType"
] = None,
direct_put_source_configuration: Optional[
"capo_firehose.types.direct_put_source_configuration.DirectPutSourceConfiguration"
] = None,
kinesis_stream_source_configuration: Optional[
"capo_firehose.types.kinesis_stream_source_configuration.KinesisStreamSourceConfiguration"
] = None,
delivery_stream_encryption_configuration_input: Optional[
"capo_firehose.types.delivery_stream_encryption_configuration_input.DeliveryStreamEncryptionConfigurationInput"
] = None,
s3_destination_configuration: Optional[
"capo_firehose.types.s3_destination_configuration.S3DestinationConfiguration"
] = None,
extended_s3_destination_configuration: Optional[
"capo_firehose.types.extended_s3_destination_configuration.ExtendedS3DestinationConfiguration"
] = None,
redshift_destination_configuration: Optional[
"capo_firehose.types.redshift_destination_configuration.RedshiftDestinationConfiguration"
] = None,
elasticsearch_destination_configuration: Optional[
"capo_firehose.types.elasticsearch_destination_configuration.ElasticsearchDestinationConfiguration"
] = None,
amazonopensearchservice_destination_configuration: Optional[
"capo_firehose.types.amazonopensearchservice_destination_configuration.AmazonopensearchserviceDestinationConfiguration"
] = None,
splunk_destination_configuration: Optional[
"capo_firehose.types.splunk_destination_configuration.SplunkDestinationConfiguration"
] = None,
http_endpoint_destination_configuration: Optional[
"capo_firehose.types.http_endpoint_destination_configuration.HttpEndpointDestinationConfiguration"
] = None,
tags: Optional[
"capo_firehose.types.tag_delivery_stream_input_tag_list.TagDeliveryStreamInputTagList"
] = None,
amazon_open_search_serverless_destination_configuration: Optional[
"capo_firehose.types.amazon_open_search_serverless_destination_configuration.AmazonOpenSearchServerlessDestinationConfiguration"
] = None,
msk_source_configuration: Optional[
"capo_firehose.types.msk_source_configuration.MSKSourceConfiguration"
] = None,
snowflake_destination_configuration: Optional[
"capo_firehose.types.snowflake_destination_configuration.SnowflakeDestinationConfiguration"
] = None,
iceberg_destination_configuration: Optional[
"capo_firehose.types.iceberg_destination_configuration.IcebergDestinationConfiguration"
] = None,
database_source_configuration: Optional[
"capo_firehose.types.database_source_configuration.DatabaseSourceConfiguration"
] = None,
) -> "capo_firehose.types.create_delivery_stream_output.CreateDeliveryStreamOutput":
"""<p>Creates a Firehose stream.</p> <p>By default, you can create up to 5,000 Firehose streams per Amazon Web Services Region.</p> <p>This is an asynchronous operation that immediately returns. The initial status of the Firehose stream is <code>CREATING</code>. After the Firehose stream is created, its status is <code>ACTIVE</code> and it now accepts data. If the Firehose stream creation fails, the status transitions to <code>CREATING_FAILED</code>. Attempts to send data to a delivery stream that is not in the <code>ACTIVE</code> state cause an exception. To check the state of a Firehose stream, use <a>DescribeDeliveryStream</a>.</p> <p>If the status of a Firehose stream is <code>CREATING_FAILED</code>, this status doesn't change, and you can't invoke <code>CreateDeliveryStream</code> again on it. However, you can invoke the <a>DeleteDeliveryStream</a> operation to delete it.</p> <p>A Firehose stream can be configured to receive records directly from providers using <a>PutRecord</a> or <a>PutRecordBatch</a>, or it can be configured to use an existing Kinesis stream as its source. To specify a Kinesis data stream as input, set the <code>DeliveryStreamType</code> parameter to <code>KinesisStreamAsSource</code>, and provide the Kinesis stream Amazon Resource Name (ARN) and role ARN in the <code>KinesisStreamSourceConfiguration</code> parameter.</p> <p>To create a Firehose stream with server-side encryption (SSE) enabled, include <a>DeliveryStreamEncryptionConfigurationInput</a> in your request. This is optional. You can also invoke <a>StartDeliveryStreamEncryption</a> to turn on SSE for an existing Firehose stream that doesn't have SSE enabled.</p> <p>A Firehose stream is configured with a single destination, such as Amazon Simple Storage Service (Amazon S3), Amazon Redshift, Amazon OpenSearch Service, Amazon OpenSearch Serverless, Splunk, and any custom HTTP endpoint or HTTP endpoints owned by or supported by third-party service providers, including Datadog, Dynatrace, LogicMonitor, MongoDB, New Relic, and Sumo Logic. You must specify only one of the following destination configuration parameters: <code>ExtendedS3DestinationConfiguration</code>, <code>S3DestinationConfiguration</code>, <code>ElasticsearchDestinationConfiguration</code>, <code>RedshiftDestinationConfiguration</code>, or <code>SplunkDestinationConfiguration</code>.</p> <p>When you specify <code>S3DestinationConfiguration</code>, you can also provide the following optional values: BufferingHints, <code>EncryptionConfiguration</code>, and <code>CompressionFormat</code>. By default, if no <code>BufferingHints</code> value is provided, Firehose buffers data up to 5 MB or for 5 minutes, whichever condition is satisfied first. <code>BufferingHints</code> is a hint, so there are some cases where the service cannot adhere to these conditions strictly. For example, record boundaries might be such that the size is a little over or under the configured buffering size. By default, no encryption is performed. We strongly recommend that you enable encryption to ensure secure data storage in Amazon S3.</p> <p>A few notes about Amazon Redshift as a destination:</p> <ul> <li> <p>An Amazon Redshift destination requires an S3 bucket as intermediate location. Firehose first delivers data to Amazon S3 and then uses <code>COPY</code> syntax to load data into an Amazon Redshift table. This is specified in the <code>RedshiftDestinationConfiguration.S3Configuration</code> parameter.</p> </li> <li> <p>The compression formats <code>SNAPPY</code> or <code>ZIP</code> cannot be specified in <code>RedshiftDestinationConfiguration.S3Configuration</code> because the Amazon Redshift <code>COPY</code> operation that reads from the S3 bucket doesn't support these compression formats.</p> </li> <li> <p>We strongly recommend that you use the user name and password you provide exclusively with Firehose, and that the permissions for the account are restricted for Amazon Redshift <code>INSERT</code> permissions.</p> </li> </ul> <p>Firehose assumes the IAM role that is configured as part of the destination. The role should allow the Firehose principal to assume the role, and the role should have permissions that allow the service to deliver the data. For more information, see <a href="https://docs.aws.amazon.com/firehose/latest/dev/controlling-access.html#using-iam-s3">Grant Firehose Access to an Amazon S3 Destination</a> in the <i>Amazon Firehose Developer Guide</i>.</p>
Args:
delivery_stream_name: <p>The name of the Firehose stream. This name must be unique per Amazon Web Services account in the same Amazon Web Services Region. If the Firehose streams are in different accounts or different Regions, you can have multiple Firehose streams with the same name.</p>
delivery_stream_type: <p>The Firehose stream type. This parameter can be one of the following values:</p> <ul> <li> <p> <code>DirectPut</code>: Provider applications access the Firehose stream directly.</p> </li> <li> <p> <code>KinesisStreamAsSource</code>: The Firehose stream uses a Kinesis data stream as a source.</p> </li> </ul>
direct_put_source_configuration: <p>The structure that configures parameters such as <code>ThroughputHintInMBs</code> for a stream configured with Direct PUT as a source. </p>
kinesis_stream_source_configuration: <p>When a Kinesis data stream is used as the source for the Firehose stream, a <a>KinesisStreamSourceConfiguration</a> containing the Kinesis data stream Amazon Resource Name (ARN) and the role ARN for the source stream.</p>
delivery_stream_encryption_configuration_input: <p>Used to specify the type and Amazon Resource Name (ARN) of the KMS key needed for Server-Side Encryption (SSE).</p>
s3_destination_configuration: <p>[Deprecated] The destination in Amazon S3. You can specify only one destination.</p>
extended_s3_destination_configuration: <p>The destination in Amazon S3. You can specify only one destination.</p>
redshift_destination_configuration: <p>The destination in Amazon Redshift. You can specify only one destination.</p>
elasticsearch_destination_configuration: <p>The destination in Amazon OpenSearch Service. You can specify only one destination.</p>
amazonopensearchservice_destination_configuration: <p>The destination in Amazon OpenSearch Service. You can specify only one destination.</p>
splunk_destination_configuration: <p>The destination in Splunk. You can specify only one destination.</p>
http_endpoint_destination_configuration: <p>Enables configuring Kinesis Firehose to deliver data to any HTTP endpoint destination. You can specify only one destination.</p>
tags: <p>A set of tags to assign to the Firehose stream. A tag is a key-value pair that you can define and assign to Amazon Web Services resources. Tags are metadata. For example, you can add friendly names and descriptions or other types of information that can help you distinguish the Firehose stream. For more information about tags, see <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html">Using Cost Allocation Tags</a> in the Amazon Web Services Billing and Cost Management User Guide.</p> <p>You can specify up to 50 tags when creating a Firehose stream.</p> <p>If you specify tags in the <code>CreateDeliveryStream</code> action, Amazon Data Firehose performs an additional authorization on the <code>firehose:TagDeliveryStream</code> action to verify if users have permissions to create tags. If you do not provide this permission, requests to create new Firehose streams with IAM resource tags will fail with an <code>AccessDeniedException</code> such as following.</p> <p> <b>AccessDeniedException</b> </p> <p>User: arn:aws:sts::x:assumed-role/x/x is not authorized to perform: firehose:TagDeliveryStream on resource: arn:aws:firehose:us-east-1:x:deliverystream/x with an explicit deny in an identity-based policy.</p> <p>For an example IAM policy, see <a href="https://docs.aws.amazon.com/firehose/latest/APIReference/API_CreateDeliveryStream.html#API_CreateDeliveryStream_Examples">Tag example.</a> </p>
amazon_open_search_serverless_destination_configuration: <p>The destination in the Serverless offering for Amazon OpenSearch Service. You can specify only one destination.</p>
snowflake_destination_configuration: <p>Configure Snowflake destination</p>
iceberg_destination_configuration: <p> Configure Apache Iceberg Tables destination. </p>
database_source_configuration: <p> The top level object for configuring streams with database as a source. </p> <p>Amazon Data Firehose is in preview release and is subject to change.</p>
Raises:
capo_firehose.errors.invalid_argument_exception.InvalidArgumentException: <p>The specified input parameter has a value that is not valid.</p>
capo_firehose.errors.invalid_kms_resource_exception.InvalidKMSResourceException: <p>Firehose throws this exception when an attempt to put records or to start or stop Firehose stream encryption fails. This happens when the KMS service throws one of the following exception types: <code>AccessDeniedException</code>, <code>InvalidStateException</code>, <code>DisabledException</code>, or <code>NotFoundException</code>.</p>
capo_firehose.errors.limit_exceeded_exception.LimitExceededException: <p>You have already reached the limit for a requested resource.</p>
capo_firehose.errors.resource_in_use_exception.ResourceInUseException: <p>The resource is already in use and not available for this operation.</p>
capo_firehose.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_firehose.types.create_delivery_stream_input.CreateDeliveryStreamInput]",
) -> AsyncOperationResponse[
"capo_firehose.types.create_delivery_stream_output.CreateDeliveryStreamOutput"
]:
import capo_firehose._operations.firehose_20150804.create_delivery_stream
(
output,
http_response,
) = await capo_firehose._operations.firehose_20150804.create_delivery_stream.async_create_delivery_stream(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_firehose.types.create_delivery_stream_input.CreateDeliveryStreamInput",
) -> dict[str, Any]:
import capo_firehose.types.create_delivery_stream_input
return capo_firehose.types.create_delivery_stream_input.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CreateDeliveryStream", redact_input=_redact_input),
)
input_: capo_firehose.types.create_delivery_stream_input.CreateDeliveryStreamInput = {
"delivery_stream_name": delivery_stream_name
}
if delivery_stream_type is not None:
input_["delivery_stream_type"] = delivery_stream_type
if direct_put_source_configuration is not None:
input_["direct_put_source_configuration"] = direct_put_source_configuration
if kinesis_stream_source_configuration is not None:
input_["kinesis_stream_source_configuration"] = (
kinesis_stream_source_configuration
)
if delivery_stream_encryption_configuration_input is not None:
input_["delivery_stream_encryption_configuration_input"] = (
delivery_stream_encryption_configuration_input
)
if s3_destination_configuration is not None:
input_["s3_destination_configuration"] = s3_destination_configuration
if extended_s3_destination_configuration is not None:
input_["extended_s3_destination_configuration"] = (
extended_s3_destination_configuration
)
if redshift_destination_configuration is not None:
input_["redshift_destination_configuration"] = (
redshift_destination_configuration
)
if elasticsearch_destination_configuration is not None:
input_["elasticsearch_destination_configuration"] = (
elasticsearch_destination_configuration
)
if amazonopensearchservice_destination_configuration is not None:
input_["amazonopensearchservice_destination_configuration"] = (
amazonopensearchservice_destination_configuration
)
if splunk_destination_configuration is not None:
input_["splunk_destination_configuration"] = (
splunk_destination_configuration
)
if http_endpoint_destination_configuration is not None:
input_["http_endpoint_destination_configuration"] = (
http_endpoint_destination_configuration
)
if tags is not None:
input_["tags"] = tags
if amazon_open_search_serverless_destination_configuration is not None:
input_["amazon_open_search_serverless_destination_configuration"] = (
amazon_open_search_serverless_destination_configuration
)
if msk_source_configuration is not None:
input_["msk_source_configuration"] = msk_source_configuration
if snowflake_destination_configuration is not None:
input_["snowflake_destination_configuration"] = (
snowflake_destination_configuration
)
if iceberg_destination_configuration is not None:
input_["iceberg_destination_configuration"] = (
iceberg_destination_configuration
)
if database_source_configuration is not None:
input_["database_source_configuration"] = database_source_configuration
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|