KinesisStream
Reference doc for the `sst.aws.KinesisStream` component.
The KinesisStream
component lets you add an Amazon Kinesis Data Streams to your app.
Minimal example
Subscribe to a stream
Link the stream to a resource
You can link the stream to other resources, like a function or your Next.js app.
Once linked, you can write to the stream from your function code.
Constructor
Parameters
-
name
string
-
args?
KinesisStreamArgs
-
opts?
ComponentResourceOptions
KinesisStreamArgs
transform?
transform.stream?
Type StreamArgs
|
(
args
:
StreamArgs
,
opts
:
ComponentResourceOptions
,
name
:
string
)
=>
void
Transform the Kinesis stream resource.
Properties
arn
Type Output
<
string
>
name
Type Output
<
string
>
nodes
nodes.stream
Type Stream
The Amazon Kinesis Data Stream.
SDK
Use the SDK in your runtime to interact with your infrastructure.
Links
This is accessible through the Resource
object in the SDK.
-
name
string
Methods
subscribe
Parameters
The name of the subscriber.name
string
The function that’ll be notified.subscriber
Input
<
string
|
FunctionArgs
|
“arn:aws:lambda:${string}”
>
- Configure the subscription.
Returns Output
<
KinesisStreamLambdaSubscriber
>
Subscribe to the Kinesis stream.
Add a filter to the subscription.
Customize the subscriber function.
Or pass in the ARN of an existing Lambda function.
static subscribe
Parameters
The name of the subscriber.name
string
The ARN of the Kinesis Stream to subscribe to.streamArn
Input
<
string
>
The function that’ll be notified.subscriber
Input
<
string
|
FunctionArgs
|
“arn:aws:lambda:${string}”
>
- Configure the subscription.
Returns Output
<
KinesisStreamLambdaSubscriber
>
Subscribe to the Kinesis stream that was not created in your app.
For example, let’s say you have the ARN of an existing Kinesis stream.
You can subscribe to it by passing in the ARN.
Add a filter to the subscription.
Customize the subscriber function.
KinesisStreamLambdaSubscriberArgs
filters?
Type Input
<
Input
<
Record
<
string
, any
>
>
[]
>
Filter the events that’ll be processed by the subscribers
functions.
You can pass in up to 5 different filter policies. These will logically ORed together. Meaning that if any single policy matches, the record will be processed. Learn more about the filter rule syntax.
For example, if your Kinesis stream contains events in this JSON format.
To process only those events where the type
is buy
.
transform?
Type Object
Transform how this component creates its underlying resources.
transform.eventSourceMapping?
Type EventSourceMappingArgs
|
(
args
:
EventSourceMappingArgs
,
opts
:
ComponentResourceOptions
,
name
:
string
)
=>
void
Transform the Lambda Event Source Mapping resource.