AWS Kinesis Stream
This page shows how to write Terraform and CloudFormation for Kinesis Stream and write them securely.
aws_kinesis_stream (Terraform)
The Stream in Kinesis can be configured in Terraform with the resource name aws_kinesis_stream
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_kinesis_stream" "sensitive_stream" {
encryption_type = "NONE" # Noncompliant {{Make sure allowing clear-text traffic is safe here.}}
# ^^^^^^
}
# Noncompliant@+1 {{Omitting encryption_type enables clear-text traffic. Make sure it is safe here.}}
resource "aws_kinesis_stream" "kinesisEncryptedWithKms" {
name = "kinesisEncryptedWithKms"
shard_count = 1
retention_period = 48
shard_level_metrics = [
resource "aws_kinesis_stream" "kinesisEncryptedWithKms" {
name = "kinesisEncryptedWithKms"
shard_count = 1
retention_period = 48
shard_level_metrics = [
resource "aws_kinesis_stream" "good" {
name = "snowplow-good-stream"
shard_count = var.number_of_shards_good_stream
retention_period = 24
enforce_consumer_deletion = true
Parameters
-
arn
optional computed - string -
encryption_type
optional - string -
enforce_consumer_deletion
optional - bool -
id
optional computed - string -
kms_key_id
optional - string -
name
required - string -
retention_period
optional - number -
shard_count
required - number -
shard_level_metrics
optional - set of string -
tags
optional - map from string to string -
timeouts
single block
Explanation in Terraform Registry
Provides a Kinesis Stream resource. Amazon Kinesis is a managed service that scales elastically for real-time processing of streaming big data. For more details, see the [Amazon Kinesis Documentation][1].
AWS::Kinesis::Stream (CloudFormation)
The Stream in Kinesis can be configured in CloudFormation with the resource name AWS::Kinesis::Stream
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: 'AWS::Kinesis::Stream'
Properties:
Name: Watchtower${self:provider.stage}InvocationStream
ShardCount: 10
##
## Events Kinesis Stream
Type: AWS::Kinesis::Stream
Properties:
Name: int-test-stream-1
ShardCount: 1
KinesisStream2:
Type: AWS::Kinesis::Stream
Type: AWS::Kinesis::Stream
Properties:
ShardCount: 1
CoursesStream:
Type: AWS::Kinesis::Stream
Type: AWS::Kinesis::Stream
Properties:
Name: int-test-stream-1
ShardCount: 1
KinesisStream2:
Type: AWS::Kinesis::Stream
Type: AWS::Kinesis::Stream
Properties:
Name: identities-${opt:stage}
ShardCount: 1
CoursesStream:
"Type": "AWS::Kinesis::Stream",
"Properties": {
"Name": "a0007-sp-prod-good",
"ShardCount": 5
}
},
"Type": "AWS::Kinesis::Stream",
"Properties": {
"Name": "a0007-sp-prod-good",
"ShardCount": 10
}
},
"Type": "AWS::Kinesis::Stream",
"Properties": {
"Name": "a0007-sp-dev-good",
"ShardCount": 5
}
},
"Type" : "AWS::Kinesis::Stream",
"Properties" : {
"Name" : "DataStream",
"RetentionPeriodHours" : {
"Ref" : "RetentionPeriod"
},
"Type": "AWS::Kinesis::Stream",
"Properties": {
"Name": {
"Fn::Join": [
"",
[
Parameters
-
Name
optional - String -
RetentionPeriodHours
optional - Integer -
ShardCount
required - Integer -
StreamEncryption
optional - StreamEncryption -
Tags
optional - List of Tag
Explanation in CloudFormation Registry
Creates a Kinesis stream that captures and transports data records that are emitted from data sources. For information about creating streams, see CreateStream in the Amazon Kinesis API Reference.
Frequently asked questions
What is AWS Kinesis Stream?
AWS Kinesis Stream is a resource for Kinesis of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Kinesis Stream?
For Terraform, the SonarSource/sonar-iac, kanchwala-yusuf/aws-terraform and storebot/pr_demo_flat source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the kalevalp/watchtower, WW-Digital/reactive-kinesis and OffCourse/infrastructure source code examples are useful. See the CloudFormation Example section for further details.