createDeliveryStream method
- required String deliveryStreamName,
- AmazonOpenSearchServerlessDestinationConfiguration? amazonOpenSearchServerlessDestinationConfiguration,
- AmazonopensearchserviceDestinationConfiguration? amazonopensearchserviceDestinationConfiguration,
- DatabaseSourceConfiguration? databaseSourceConfiguration,
- DeliveryStreamEncryptionConfigurationInput? deliveryStreamEncryptionConfigurationInput,
- DeliveryStreamType? deliveryStreamType,
- DirectPutSourceConfiguration? directPutSourceConfiguration,
- ElasticsearchDestinationConfiguration? elasticsearchDestinationConfiguration,
- ExtendedS3DestinationConfiguration? extendedS3DestinationConfiguration,
- HttpEndpointDestinationConfiguration? httpEndpointDestinationConfiguration,
- IcebergDestinationConfiguration? icebergDestinationConfiguration,
- KinesisStreamSourceConfiguration? kinesisStreamSourceConfiguration,
- MSKSourceConfiguration? mSKSourceConfiguration,
- RedshiftDestinationConfiguration? redshiftDestinationConfiguration,
- S3DestinationConfiguration? s3DestinationConfiguration,
- SnowflakeDestinationConfiguration? snowflakeDestinationConfiguration,
- SplunkDestinationConfiguration? splunkDestinationConfiguration,
- List<
Tag> ? tags,
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
COPYsyntax to load data into an Amazon Redshift table. This is specified in theRedshiftDestinationConfiguration.S3Configurationparameter. -
The compression formats
SNAPPYorZIPcannot be specified inRedshiftDestinationConfiguration.S3Configurationbecause the Amazon RedshiftCOPYoperation 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
INSERTpermissions.
May throw InvalidArgumentException.
May throw InvalidKMSResourceException.
May throw LimitExceededException.
May throw ResourceInUseException.
Parameter 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.
Parameter amazonOpenSearchServerlessDestinationConfiguration :
The destination in the Serverless offering for Amazon OpenSearch Service.
You can specify only one destination.
Parameter amazonopensearchserviceDestinationConfiguration :
The destination in Amazon OpenSearch Service. You can specify only one
destination.
Parameter databaseSourceConfiguration :
The top level object for configuring streams with database as a source.
Amazon Data Firehose is in preview release and is subject to change.
Parameter deliveryStreamEncryptionConfigurationInput :
Used to specify the type and Amazon Resource Name (ARN) of the KMS key
needed for Server-Side Encryption (SSE).
Parameter deliveryStreamType :
The Firehose stream type. This parameter can be one of the following
values:
-
DirectPut: Provider applications access the Firehose stream directly. -
KinesisStreamAsSource: The Firehose stream uses a Kinesis data stream as a source.
Parameter directPutSourceConfiguration :
The structure that configures parameters such as
ThroughputHintInMBs for a stream configured with Direct PUT
as a source.
Parameter elasticsearchDestinationConfiguration :
The destination in Amazon OpenSearch Service. You can specify only one
destination.
Parameter extendedS3DestinationConfiguration :
The destination in Amazon S3. You can specify only one destination.
Parameter httpEndpointDestinationConfiguration :
Enables configuring Kinesis Firehose to deliver data to any HTTP endpoint
destination. You can specify only one destination.
Parameter icebergDestinationConfiguration :
Configure Apache Iceberg Tables destination.
Parameter kinesisStreamSourceConfiguration :
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.
Parameter redshiftDestinationConfiguration :
The destination in Amazon Redshift. You can specify only one destination.
Parameter s3DestinationConfiguration :
[Deprecated] The destination in Amazon S3. You can specify only one
destination.
Parameter snowflakeDestinationConfiguration :
Configure Snowflake destination
Parameter splunkDestinationConfiguration :
The destination in Splunk. You can specify only one destination.
Parameter tags :
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.
Implementation
Future<CreateDeliveryStreamOutput> createDeliveryStream({
required String deliveryStreamName,
AmazonOpenSearchServerlessDestinationConfiguration?
amazonOpenSearchServerlessDestinationConfiguration,
AmazonopensearchserviceDestinationConfiguration?
amazonopensearchserviceDestinationConfiguration,
DatabaseSourceConfiguration? databaseSourceConfiguration,
DeliveryStreamEncryptionConfigurationInput?
deliveryStreamEncryptionConfigurationInput,
DeliveryStreamType? deliveryStreamType,
DirectPutSourceConfiguration? directPutSourceConfiguration,
ElasticsearchDestinationConfiguration?
elasticsearchDestinationConfiguration,
ExtendedS3DestinationConfiguration? extendedS3DestinationConfiguration,
HttpEndpointDestinationConfiguration? httpEndpointDestinationConfiguration,
IcebergDestinationConfiguration? icebergDestinationConfiguration,
KinesisStreamSourceConfiguration? kinesisStreamSourceConfiguration,
MSKSourceConfiguration? mSKSourceConfiguration,
RedshiftDestinationConfiguration? redshiftDestinationConfiguration,
S3DestinationConfiguration? s3DestinationConfiguration,
SnowflakeDestinationConfiguration? snowflakeDestinationConfiguration,
SplunkDestinationConfiguration? splunkDestinationConfiguration,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Firehose_20150804.CreateDeliveryStream'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DeliveryStreamName': deliveryStreamName,
if (amazonOpenSearchServerlessDestinationConfiguration != null)
'AmazonOpenSearchServerlessDestinationConfiguration':
amazonOpenSearchServerlessDestinationConfiguration,
if (amazonopensearchserviceDestinationConfiguration != null)
'AmazonopensearchserviceDestinationConfiguration':
amazonopensearchserviceDestinationConfiguration,
if (databaseSourceConfiguration != null)
'DatabaseSourceConfiguration': databaseSourceConfiguration,
if (deliveryStreamEncryptionConfigurationInput != null)
'DeliveryStreamEncryptionConfigurationInput':
deliveryStreamEncryptionConfigurationInput,
if (deliveryStreamType != null)
'DeliveryStreamType': deliveryStreamType.value,
if (directPutSourceConfiguration != null)
'DirectPutSourceConfiguration': directPutSourceConfiguration,
if (elasticsearchDestinationConfiguration != null)
'ElasticsearchDestinationConfiguration':
elasticsearchDestinationConfiguration,
if (extendedS3DestinationConfiguration != null)
'ExtendedS3DestinationConfiguration':
extendedS3DestinationConfiguration,
if (httpEndpointDestinationConfiguration != null)
'HttpEndpointDestinationConfiguration':
httpEndpointDestinationConfiguration,
if (icebergDestinationConfiguration != null)
'IcebergDestinationConfiguration': icebergDestinationConfiguration,
if (kinesisStreamSourceConfiguration != null)
'KinesisStreamSourceConfiguration': kinesisStreamSourceConfiguration,
if (mSKSourceConfiguration != null)
'MSKSourceConfiguration': mSKSourceConfiguration,
if (redshiftDestinationConfiguration != null)
'RedshiftDestinationConfiguration': redshiftDestinationConfiguration,
if (s3DestinationConfiguration != null)
'S3DestinationConfiguration': s3DestinationConfiguration,
if (snowflakeDestinationConfiguration != null)
'SnowflakeDestinationConfiguration':
snowflakeDestinationConfiguration,
if (splunkDestinationConfiguration != null)
'SplunkDestinationConfiguration': splunkDestinationConfiguration,
if (tags != null) 'Tags': tags,
},
);
return CreateDeliveryStreamOutput.fromJson(jsonResponse.body);
}