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

test_kinesis_stream.tf#L1
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.}}
aws_kinesis_stream.tf#L5
resource "aws_kinesis_stream" "kinesisEncryptedWithKms" {
  name             = "kinesisEncryptedWithKms"
  shard_count      = 1
  retention_period = 48

  shard_level_metrics = [
kinesis.tf#L1
resource "aws_kinesis_stream" "kinesisEncryptedWithKms" {
  name             = "kinesisEncryptedWithKms"
  shard_count      = 1
  retention_period = 48

  shard_level_metrics = [
main.tf#L1
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

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

cftemplate.yml#L5
    Type: AWS::Kinesis::Stream
    Properties:
      Name: int-test-stream-1
      ShardCount: 1
  KinesisStream2:
    Type: AWS::Kinesis::Stream
kinesisStreams.yml#L5
    Type: 'AWS::Kinesis::Stream'
    Properties:
      Name: Watchtower${self:provider.stage}InvocationStream
      ShardCount: 10
  ##
  ##   Events Kinesis Stream
streams.yml#L5
    Type: AWS::Kinesis::Stream
    Properties:
      ShardCount: 1

  CoursesStream:
    Type: AWS::Kinesis::Stream
cftemplate.yml#L5
    Type: AWS::Kinesis::Stream
    Properties:
      Name: int-test-stream-1
      ShardCount: 1
  KinesisStream2:
    Type: AWS::Kinesis::Stream
streams.yml#L2
  Type: AWS::Kinesis::Stream
  Properties:
    Name: identities-${opt:stage}
    ShardCount: 1

CoursesStream:
snowplow-kinesis-staging-cftemplate.json#L6
            "Type": "AWS::Kinesis::Stream",
            "Properties": {
                "Name": "a0007-sp-prod-good",
                "ShardCount": 5
            }
        },
snowplow-kinesis-dev-cftemplate.json#L6
            "Type": "AWS::Kinesis::Stream",
            "Properties": {
                "Name": "a0007-sp-dev-good",
                "ShardCount": 5
            }
        },
snowplow-kinesis-prod-cftemplate.json#L6
            "Type": "AWS::Kinesis::Stream",
            "Properties": {
                "Name": "a0007-sp-prod-good",
                "ShardCount": 10
            }
        },
data_stream.json#L18
            "Type" : "AWS::Kinesis::Stream",
            "Properties" : {
                "Name" : "DataStream",
                "RetentionPeriodHours" : {
                    "Ref" : "RetentionPeriod"
                },
kinesis.template.json#L11
      "Type": "AWS::Kinesis::Stream",
      "Properties": {
        "Name": {
          "Fn::Join": [
            "",
            [

Parameters

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 WW-Digital/reactive-kinesis, kalevalp/watchtower and OffCourse/infrastructure source code examples are useful. See the CloudFormation Example section for further details.