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