I want to stream some logs from cloudwatch to S3. For this I have created the resources via CDK. The code relevant to Kinesis is -
const rootStream = new Stream(this, 'Root', {
streamName: `stream-name`
});
const firehoseRole = new Role(this, `some-id`, {
assumedBy: new ServicePrincipal('firehose.amazonaws.com'),
roleName: `some-role-name`
});
rootStream.grantRead(firehoseRole);
rootStream.grant(firehoseRole, 'kinesis:DescribeStream');
const firehoseStreamToS3 = new CfnDeliveryStream(...);// omitted the large config
const subFilterDestination = new KinesisDestination(rootStream);
const subFilter = new SubscriptionFilter(this, 'xyz', {
destination: subFilterDestination,
filterPattern: FilterPattern.literal('some=pattern'),
logGroup: myLogGroup
});
subFilter.node.addDependency(myLogGroup);
During deployment I get the error
X:XX:XX PM | CREATE_FAILED | AWS::Logs::SubscriptionFilter | LogProcessingFilterXYZABC
Resource handler returned message: "Could not deliver test message to specified Kinesis stream. Check if the given kinesis strea
m is in ACTIVE state. (Service: CloudWatchLogs, Status Code: 400, Request ID: abcdef-bbbb-cccc-dddd-xxxxxxxxx)" (RequestTok
en: xxxxxxxxxxxxxxxx, HandlerErrorCode: InternalFailure)
What is the cause of this error and how to fix it?