github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/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 ```hcl 20 resource "aws_s3_bucket" "bucket" { 21 bucket = "tf-test-bucket" 22 acl = "private" 23 } 24 25 resource "aws_iam_role" "firehose_role" { 26 name = "firehose_test_role" 27 28 assume_role_policy = <<EOF 29 { 30 "Version": "2012-10-17", 31 "Statement": [ 32 { 33 "Action": "sts:AssumeRole", 34 "Principal": { 35 "Service": "firehose.amazonaws.com" 36 }, 37 "Effect": "Allow", 38 "Sid": "" 39 } 40 ] 41 } 42 EOF 43 } 44 45 resource "aws_kinesis_firehose_delivery_stream" "test_stream" { 46 name = "terraform-kinesis-firehose-test-stream" 47 destination = "s3" 48 49 s3_configuration { 50 role_arn = "${aws_iam_role.firehose_role.arn}" 51 bucket_arn = "${aws_s3_bucket.bucket.arn}" 52 } 53 } 54 ``` 55 56 ### Redshift Destination 57 58 ```hcl 59 resource "aws_redshift_cluster" "test_cluster" { 60 cluster_identifier = "tf-redshift-cluster-%d" 61 database_name = "test" 62 master_username = "testuser" 63 master_password = "T3stPass" 64 node_type = "dc1.large" 65 cluster_type = "single-node" 66 } 67 68 resource "aws_kinesis_firehose_delivery_stream" "test_stream" { 69 name = "terraform-kinesis-firehose-test-stream" 70 destination = "redshift" 71 72 s3_configuration { 73 role_arn = "${aws_iam_role.firehose_role.arn}" 74 bucket_arn = "${aws_s3_bucket.bucket.arn}" 75 buffer_size = 10 76 buffer_interval = 400 77 compression_format = "GZIP" 78 } 79 80 redshift_configuration { 81 role_arn = "${aws_iam_role.firehose_role.arn}" 82 cluster_jdbcurl = "jdbc:redshift://${aws_redshift_cluster.test_cluster.endpoint}/${aws_redshift_cluster.test_cluster.database_name}" 83 username = "testuser" 84 password = "T3stPass" 85 data_table_name = "test-table" 86 copy_options = "delimiter '|'" # the default delimiter 87 data_table_columns = "test-col" 88 } 89 } 90 ``` 91 92 ### Elasticsearch Destination 93 94 ```hcl 95 resource "aws_elasticsearch_domain" "test_cluster" { 96 domain_name = "firehose-es-test" 97 } 98 99 resource "aws_kinesis_firehose_delivery_stream" "test_stream" { 100 name = "terraform-kinesis-firehose-test-stream" 101 destination = "elasticsearch" 102 103 s3_configuration { 104 role_arn = "${aws_iam_role.firehose_role.arn}" 105 bucket_arn = "${aws_s3_bucket.bucket.arn}" 106 buffer_size = 10 107 buffer_interval = 400 108 compression_format = "GZIP" 109 } 110 111 elasticsearch_configuration { 112 domain_arn = "${aws_elasticsearch_domain.test_cluster.arn}" 113 role_arn = "${aws_iam_role.firehose_role.arn}" 114 index_name = "test" 115 type_name = "test" 116 } 117 } 118 ``` 119 120 ~> **NOTE:** Kinesis Firehose is currently only supported in us-east-1, us-west-2 and eu-west-1. 121 122 ## Argument Reference 123 124 The following arguments are supported: 125 126 * `name` - (Required) A name to identify the stream. This is unique to the 127 AWS account and region the Stream is created in. 128 * `destination` – (Required) This is the destination to where the data is delivered. The only options are `s3`, `redshift`, and `elasticsearch`. 129 * `s3_configuration` - (Required) Configuration options for the s3 destination (or the intermediate bucket if the destination 130 is redshift). More details are given below. 131 * `redshift_configuration` - (Optional) Configuration options if redshift is the destination. 132 Using `redshift_configuration` requires the user to also specify a 133 `s3_configuration` block. More details are given below. 134 135 The `s3_configuration` object supports the following: 136 137 * `role_arn` - (Required) The ARN of the AWS credentials. 138 * `bucket_arn` - (Required) The ARN of the S3 bucket 139 * `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 140 * `buffer_size` - (Optional) Buffer incoming data to the specified size, in MBs, before delivering it to the destination. The default value is 5. 141 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. 142 * `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. 143 * `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. 144 * `kms_key_arn` - (Optional) Specifies the KMS key ARN the stream will use to encrypt data. If not set, no encryption will 145 be used. 146 * `cloudwatch_logging_options` - (Optional) The CloudWatch Logging Options for the delivery stream. More details are given below 147 148 The `redshift_configuration` object supports the following: 149 150 * `cluster_jdbcurl` - (Required) The jdbcurl of the redshift cluster. 151 * `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. 152 * `password` - (Required) The password for the username above. 153 * `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. 154 * `role_arn` - (Required) The arn of the role the stream assumes. 155 * `data_table_name` - (Required) The name of the table in the redshift cluster that the s3 bucket will copy to. 156 * `copy_options` - (Optional) Copy options for copying the data from the s3 intermediate bucket into redshift, for example to change the default delimiter. For valid values, see the [AWS documentation](http://docs.aws.amazon.com/firehose/latest/APIReference/API_CopyCommand.html) 157 * `data_table_columns` - (Optional) The data table columns that will be targeted by the copy command. 158 * `cloudwatch_logging_options` - (Optional) The CloudWatch Logging Options for the delivery stream. More details are given below 159 160 The `elasticsearch_configuration` object supports the following: 161 162 * `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. 163 * `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. 164 * `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:.*`. 165 * `index_name` - (Required) The Elasticsearch index name. 166 * `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`. 167 * `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. 168 * `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:.*`. 169 * `s3_backup_mode` - (Optional) Defines how documents should be delivered to Amazon S3. Valid values are `FailedDocumentsOnly` and `AllDocuments`. Default value is `FailedDocumentsOnly`. 170 * `type_name` - (Required) The Elasticsearch type name with maximum length of 100 characters. 171 * `cloudwatch_logging_options` - (Optional) The CloudWatch Logging Options for the delivery stream. More details are given below 172 173 The `cloudwatch_logging_options` object supports the following: 174 175 * `enabled` - (Optional) Enables or disables the logging. Defaults to `false`. 176 * `log_group_name` - (Optional) The CloudWatch group name for logging. This value is required if `enabled` is true. 177 * `log_stream_name` - (Optional) The CloudWatch log stream name for logging. This value is required if `enabled` is true. 178 179 ## Attributes Reference 180 181 * `arn` - The Amazon Resource Name (ARN) specifying the Stream 182 183 [1]: https://aws.amazon.com/documentation/firehose/