github.com/simonswine/terraform@v0.9.0-beta2/website/source/docs/providers/aws/r/kinesis_firehose_delivery_stream.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_kinesis_firehose_delivery_stream" 4 sidebar_current: "docs-aws-resource-kinesis-firehose-delivery-stream" 5 description: |- 6 Provides a AWS Kinesis Firehose Delivery Stream 7 --- 8 9 # aws\_kinesis\_firehose\_delivery\_stream 10 11 Provides a Kinesis Firehose Delivery Stream resource. Amazon Kinesis Firehose is a fully managed, elastic service to easily deliver real-time data streams to destinations such as Amazon S3 and Amazon Redshift. 12 13 For more details, see the [Amazon Kinesis Firehose Documentation][1]. 14 15 ## Example Usage 16 17 ### S3 Destination 18 ``` 19 resource "aws_s3_bucket" "bucket" { 20 bucket = "tf-test-bucket" 21 acl = "private" 22 } 23 24 resource "aws_iam_role" "firehose_role" { 25 name = "firehose_test_role" 26 27 assume_role_policy = <<EOF 28 { 29 "Version": "2012-10-17", 30 "Statement": [ 31 { 32 "Action": "sts:AssumeRole", 33 "Principal": { 34 "Service": "firehose.amazonaws.com" 35 }, 36 "Effect": "Allow", 37 "Sid": "" 38 } 39 ] 40 } 41 EOF 42 } 43 44 resource "aws_kinesis_firehose_delivery_stream" "test_stream" { 45 name = "terraform-kinesis-firehose-test-stream" 46 destination = "s3" 47 48 s3_configuration { 49 role_arn = "${aws_iam_role.firehose_role.arn}" 50 bucket_arn = "${aws_s3_bucket.bucket.arn}" 51 } 52 } 53 ``` 54 55 ### Redshift Destination 56 57 ``` 58 resource "aws_redshift_cluster" "test_cluster" { 59 cluster_identifier = "tf-redshift-cluster-%d" 60 database_name = "test" 61 master_username = "testuser" 62 master_password = "T3stPass" 63 node_type = "dc1.large" 64 cluster_type = "single-node" 65 } 66 67 resource "aws_kinesis_firehose_delivery_stream" "test_stream" { 68 name = "terraform-kinesis-firehose-test-stream" 69 destination = "redshift" 70 71 s3_configuration { 72 role_arn = "${aws_iam_role.firehose_role.arn}" 73 bucket_arn = "${aws_s3_bucket.bucket.arn}" 74 buffer_size = 10 75 buffer_interval = 400 76 compression_format = "GZIP" 77 } 78 79 redshift_configuration { 80 role_arn = "${aws_iam_role.firehose_role.arn}" 81 cluster_jdbcurl = "jdbc:redshift://${aws_redshift_cluster.test_cluster.endpoint}/${aws_redshift_cluster.test_cluster.database_name}" 82 username = "testuser" 83 password = "T3stPass" 84 data_table_name = "test-table" 85 copy_options = "GZIP" 86 data_table_columns = "test-col" 87 } 88 } 89 ``` 90 91 ### Elasticsearch Destination 92 93 ``` 94 resource "aws_elasticsearch_domain" "test_cluster" { 95 domain_name = "firehose-es-test" 96 } 97 98 resource "aws_kinesis_firehose_delivery_stream" "test_stream" { 99 name = "terraform-kinesis-firehose-test-stream" 100 destination = "redshift" 101 102 s3_configuration { 103 role_arn = "${aws_iam_role.firehose_role.arn}" 104 bucket_arn = "${aws_s3_bucket.bucket.arn}" 105 buffer_size = 10 106 buffer_interval = 400 107 compression_format = "GZIP" 108 } 109 110 elasticsearch_configuration { 111 domain_arn = "${aws_elasticsearch_domain.test_cluster.arn}" 112 role_arn = "${aws_iam_role.firehose_role.arn}" 113 index_name = "test" 114 type_name = "test" 115 } 116 } 117 ``` 118 119 ~> **NOTE:** Kinesis Firehose is currently only supported in us-east-1, us-west-2 and eu-west-1. 120 121 ## Argument Reference 122 123 The following arguments are supported: 124 125 * `name` - (Required) A name to identify the stream. This is unique to the 126 AWS account and region the Stream is created in. 127 * `destination` – (Required) This is the destination to where the data is delivered. The only options are `s3`, `redshift`, and `elasticsearch`. 128 * `s3_configuration` - (Required) Configuration options for the s3 destination (or the intermediate bucket if the destination 129 is redshift). More details are given below. 130 * `redshift_configuration` - (Optional) Configuration options if redshift is the destination. 131 Using `redshift_configuration` requires the user to also specify a 132 `s3_configuration` block. More details are given below. 133 134 The `s3_configuration` object supports the following: 135 136 * `role_arn` - (Required) The ARN of the AWS credentials. 137 * `bucket_arn` - (Required) The ARN of the S3 bucket 138 * `prefix` - (Optional) The "YYYY/MM/DD/HH" time format prefix is automatically used for delivered S3 files. You can specify an extra prefix to be added in front of the time format prefix. Note that if the prefix ends with a slash, it appears as a folder in the S3 bucket 139 * `buffer_size` - (Optional) Buffer incoming data to the specified size, in MBs, before delivering it to the destination. The default value is 5. 140 We recommend setting SizeInMBs to a value greater than the amount of data you typically ingest into the delivery stream in 10 seconds. For example, if you typically ingest data at 1 MB/sec set SizeInMBs to be 10 MB or higher. 141 * `buffer_interval` - (Optional) Buffer incoming data for the specified period of time, in seconds, before delivering it to the destination. The default value is 300. 142 * `compression_format` - (Optional) The compression format. If no value is specified, the default is UNCOMPRESSED. Other supported values are GZIP, ZIP & Snappy. If the destination is redshift you cannot use ZIP or Snappy. 143 * `kms_key_arn` - (Optional) Specifies the KMS key ARN the stream will use to encrypt data. If not set, no encryption will 144 be used. 145 * `cloudwatch_logging_options` - (Optional) The CloudWatch Logging Options for the delivery stream. More details are given below 146 147 The `redshift_configuration` object supports the following: 148 149 * `cluster_jdbcurl` - (Required) The jdbcurl of the redshift cluster. 150 * `username` - (Required) The username that the firehose delivery stream will assume. It is strongly recommended that the username and password provided is used exclusively for Amazon Kinesis Firehose purposes, and that the permissions for the account are restricted for Amazon Redshift INSERT permissions. 151 * `password` - (Required) The password for the username above. 152 * `retry_duration` - (Optional) The length of time during which Firehose retries delivery after a failure, starting from the initial request and including the first attempt. The default value is 3600 seconds (60 minutes). Firehose does not retry if the value of DurationInSeconds is 0 (zero) or if the first delivery attempt takes longer than the current value. 153 * `role_arn` - (Required) The arn of the role the stream assumes. 154 * `data_table_name` - (Required) The name of the table in the redshift cluster that the s3 bucket will copy to. 155 * `copy_options` - (Optional) Copy options for copying the data from the s3 intermediate bucket into redshift. 156 * `data_table_columns` - (Optional) The data table columns that will be targeted by the copy command. 157 * `cloudwatch_logging_options` - (Optional) The CloudWatch Logging Options for the delivery stream. More details are given below 158 159 The `elasticsearch_configuration` object supports the following: 160 161 * `buffering_interval` - (Optional) Buffer incoming data for the specified period of time, in seconds between 60 to 900, before delivering it to the destination. The default value is 300s. 162 * `buffering_size` - (Optional) Buffer incoming data to the specified size, in MBs between 1 to 100, before delivering it to the destination. The default value is 5MB. 163 * `domain_arn` - (Required) The ARN of the Amazon ES domain. The IAM role must have permission for `DescribeElasticsearchDomain`, `DescribeElasticsearchDomains`, and `DescribeElasticsearchDomainConfig` after assuming `RoleARN`. The pattern needs to be `arn:.*`. 164 * `index_name` - (Required) The Elasticsearch index name. 165 * `index_rotation_period` - (Optional) The Elasticsearch index rotation period. Index rotation appends a timestamp to the IndexName to facilitate expiration of old data. Valid values are `NoRotation`, `OneHour`, `OneDay`, `OneWeek`, and `OneMonth`. The default value is `OneDay`. 166 * `retry_duration` - (Optional) After an initial failure to deliver to Amazon Elasticsearch, the total amount of time, in seconds between 0 to 7200, during which Firehose re-attempts delivery (including the first attempt). After this time has elapsed, the failed documents are written to Amazon S3. The default value is 300s. There will be no retry if the value is 0. 167 * `role_arn` - (Required) The ARN of the IAM role to be assumed by Firehose for calling the Amazon ES Configuration API and for indexing documents. The pattern needs to be `arn:.*`. 168 * `s3_backup_mode` - (Optional) Defines how documents should be delivered to Amazon S3. Valid values are `FailedDocumentsOnly` and `AllDocuments`. Default value is `FailedDocumentsOnly`. 169 * `type_name` - (Required) The Elasticsearch type name with maximum length of 100 characters. 170 * `cloudwatch_logging_options` - (Optional) The CloudWatch Logging Options for the delivery stream. More details are given below 171 172 The `cloudwatch_logging_options` object supports the following: 173 174 * `enabled` - (Optional) Enables or disables the logging. Defaults to `false`. 175 * `log_group_name` - (Optional) The CloudWatch group name for logging. This value is required if `enabled` is true. 176 * `log_stream_name` - (Optional) The CloudWatch log stream name for logging. This value is required if `enabled` is true. 177 178 179 180 ## Attributes Reference 181 182 * `arn` - The Amazon Resource Name (ARN) specifying the Stream 183 184 [1]: https://aws.amazon.com/documentation/firehose/