Skip to content

Commit 4937e67

Browse files
committed
revamp kinesis
1 parent 6c9c8bf commit 4937e67

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

src/content/docs/aws/services/kinesis.md

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: "Kinesis Data Streams"
3-
linkTitle: "Kinesis Data Streams"
43
description: Get started with Kinesis Data Streams on LocalStack
54
persistence: supported
65
tags: ["Free"]
@@ -12,7 +11,7 @@ Kinesis Data Streams is an AWS service for ingesting, buffering, and processing
1211
It is used for applications that require real-time processing and deriving insights from data streams such as logs, metrics, user interactions, and sensor readings.
1312

1413
LocalStack allows you to use the Kinesis Data Streams APIs in your local environment from setting up data streams and configuring data processing to building real-time applications.
15-
The supported APIs are available on our [API coverage page]({{< ref "coverage_kinesis" >}}).
14+
The supported APIs are available on our [API coverage page]().
1615

1716
Emulation for Kinesis is powered by [Kinesis Mock](https://github.com/etspaceman/kinesis-mock).
1817

@@ -42,15 +41,15 @@ export const handler = (event, context) => {
4241
You can create a Lambda function using the [`CreateFunction`](https://docs.aws.amazon.com/lambda/latest/dg/API_CreateFunction.html) API.
4342
Run the following command to create a Lambda function named `ProcessKinesisRecords`:
4443

45-
{{< command >}}
46-
$ zip function.zip index.mjs
47-
$ awslocal lambda create-function \
44+
```bash
45+
zip function.zip index.mjs
46+
awslocal lambda create-function \
4847
--function-name ProcessKinesisRecords \
4948
--zip-file fileb://function.zip \
5049
--handler index.handler \
5150
--runtime nodejs18.x \
5251
--role arn:aws:iam::000000000000:role/lambda-kinesis-role
53-
{{< / command >}}
52+
```
5453

5554
The following output would be retrieved:
5655

@@ -96,30 +95,30 @@ The JSON contains a sample Kinesis event.
9695
You can use the [`Invoke`](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html) API to invoke the Lambda function with the Kinesis event as input.
9796
Execute the following command:
9897

99-
{{< command >}}
100-
$ awslocal lambda invoke \
98+
```bash
99+
awslocal lambda invoke \
101100
--function-name ProcessKinesisRecords \
102101
--payload file://input.txt outputfile.txt
103-
{{< / command >}}
102+
```
104103

105104
### Create a Kinesis Stream
106105

107106
You can create a Kinesis Stream using the [`CreateStream`](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_CreateStream.html) API.
108107
Run the following command to create a Kinesis Stream named `lambda-stream`:
109108

110-
{{< command >}}
111-
$ awslocal kinesis create-stream \
109+
```bash
110+
awslocal kinesis create-stream \
112111
--stream-name lambda-stream \
113112
--shard-count 1
114-
{{< / command >}}
113+
```
115114

116115
You can retrieve the Stream ARN using the [`DescribeStream`](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_DescribeStream.html) API.
117116
Execute the following command:
118117

119-
{{< command >}}
120-
$ awslocal kinesis describe-stream \
118+
```bash
119+
awslocal kinesis describe-stream \
121120
--stream-name lambda-stream
122-
{{< / command >}}
121+
```
123122

124123
The following output would be retrieved:
125124

@@ -149,25 +148,25 @@ You can save the `StreamARN` value for later use.
149148
You can add an Event Source to your Lambda function using the [`CreateEventSourceMapping`](https://docs.aws.amazon.com/lambda/latest/dg/API_CreateEventSourceMapping.html) API.
150149
Run the following command to add the Kinesis Stream as an Event Source to your Lambda function:
151150

152-
{{< command >}}
153-
$ awslocal lambda create-event-source-mapping \
151+
```bash
152+
awslocal lambda create-event-source-mapping \
154153
--function-name ProcessKinesisRecords \
155154
--event-source arn:aws:kinesis:us-east-1:000000000000:stream/lambda-stream \
156155
--batch-size 100 \
157156
--starting-position LATEST
158-
{{< / command >}}
157+
```
159158

160159
### Test the Event Source mapping
161160

162161
You can test the event source mapping by adding a record to the Kinesis Stream using the [`PutRecord`](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html) API.
163162
Run the following command to add a record to the Kinesis Stream:
164163

165-
{{< command >}}
166-
$ awslocal kinesis put-record \
164+
```bash
165+
awslocal kinesis put-record \
167166
--stream-name lambda-stream \
168167
--partition-key 1 \
169168
--data "Hello, this is a test."
170-
{{< / command >}}
169+
```
171170

172171
You can fetch the CloudWatch logs for your Lambda function reading records from the stream, using AWS CLI or LocalStack Resource Browser.
173172

@@ -183,19 +182,17 @@ Additionally, the following parameters can be tuned:
183182

184183
Refer to our [Kinesis configuration documentation](https://docs.localstack.cloud/references/configuration/#kinesis) for more details on these parameters.
185184

186-
{{< callout "note" >}}
185+
:::note
187186
`KINESIS_MOCK_MAXIMUM_HEAP_SIZE` and `KINESIS_MOCK_INITIAL_HEAP_SIZE` are only applicable when using the Scala engine.
188187
Future versions of LocalStack will likely default to using the `scala` engine over the less-performant `node` version currently in use.
189-
{{< /callout >}}
188+
:::
190189

191190
## Resource Browser
192191

193192
The LocalStack Web Application provides a Resource Browser for managing Kinesis Streams & Kafka Clusters.
194193
You can access the Resource Browser by opening the LocalStack Web Application in your browser, navigating to the **Resources** section, and then clicking on **Kinesis** under the **Analytics** section.
195194

196-
<img src="kinesis-resource-browser.png" alt="Kinesis Resource Browser" title="Kinesis Resource Browser" width="900" />
197-
<br>
198-
<br>
195+
![Kinesis Resource Browser](/images/aws/kinesis-resource-browser.png)
199196

200197
The Resource Browser allows you to perform the following actions:
201198

0 commit comments

Comments
 (0)