- Create a Kinesis Data Stream.
- Create an IAM role that CloudWatch Logs can assume (trust policy).
- Attach a permission policy granting
kinesis:PutRecordandkinesis:PutRecordsto the specific stream ARN. - Create a CloudWatch Logs subscription filter pointing to the Kinesis Data Stream.
- Creating the Kinesis Data Stream
- IAM role and trust policy for CloudWatch Logs
- Permission policy: allow PutRecord and PutRecords
- Creating the CloudWatch Logs subscription filter
- Start streaming and verification
- Summary and references
LogStream).
Key options to consider:
- Capacity model: on-demand (recommended for simplicity) or provisioned.
- Record distribution strategy:
user-specifiedwhen you need explicit shard assignment; useautoif ordering is not required. - Maximum record size: keep the default unless you have special requirements.

If you expect bursts of traffic or variable throughput, the on-demand capacity mode reduces the need to manage shard scaling. Use provisioned mode when you need predictable throughput and shard-level control.
- Trust policy: permits the CloudWatch Logs service principal (
logs.amazonaws.com) to assume the role (viasts:AssumeRole). - Permission policy: grants the role
kinesis:PutRecordandkinesis:PutRecordson the specific Kinesis stream ARN.

<KINESIS_STREAM_ARN> with your stream ARN):
- Trust policy: controls who may assume the role (CloudWatch Logs via
sts:AssumeRole). - Permission policy: controls what the assumed role may do (e.g.,
kinesis:PutRecordon the specific stream).
Always reference the exact Kinesis Data Stream ARN in the permission policy. Restricting permissions to a specific resource is a security best practice.
CloudWatchLogsToKinesisRole), verify both the trust and permission policies, and create the role.
Create the CloudWatch Logs subscription filter
With the Kinesis stream and IAM role created, configure a subscription filter on the CloudWatch Logs log group you want to forward.
In CloudWatch:
- Open Log Management → Log groups.
- Select the target log group (or create one).
- From the Actions menu, choose to create a Kinesis subscription filter.

- Destination: Select the Kinesis Data Stream (same account) — e.g.,
LogStream. - Permissions: Select the IAM role you created (e.g.,
CloudWatchLogsToKinesisRole) rather than letting the console create a role automatically. - Distribution method:
By log streamensures records from each log stream map consistently to shards.Randomwill distribute events across shards (acceptable when ordering per log stream is not required).

- Log format and filter pattern: if you want all events forwarded, leave the filter pattern blank. If you need to forward only specific lines, provide a filter pattern (see CloudWatch Logs subscription filter patterns).



- Check the subscription filter is listed under the log group details.
- Monitor Kinesis metrics (IncomingRecords, PutRecord/PutRecords success/failure) in CloudWatch to confirm data flow.
- If using encryption, ensure the IAM role can use the KMS key if cross-service encryption permissions are required.
- CloudWatch Logs subscription filters can forward log events to Kinesis Data Streams for near real-time processing.
- Required IAM configuration:
- Trust policy allowing
logs.amazonaws.comto assume the role (sts:AssumeRole). - Permission policy allowing
kinesis:PutRecordandkinesis:PutRecordson the specific Kinesis stream ARN.
- Trust policy allowing
- Subscription filters can optionally filter events; leaving the pattern blank forwards all events.
- Use
By log streamdistribution when per-log-stream ordering is important.
- Amazon Kinesis Data Streams: https://docs.aws.amazon.com/streams/latest/dev/
- CloudWatch Logs subscription filters: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html
- IAM JSON policy reference: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html