繁体   English   中英

无法使用 AWS CDK 创建对 KinesisStream 的订阅过滤器

[英]Unable to create subscription filter to KinesisStream using AWS CDK

我想 stream 从 cloudwatch 到 S3 的一些日志。 为此,我通过 CDK 创建了资源。 与 Kinesis 相关的代码是 -

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);

在部署期间我收到错误

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)

此错误的原因是什么以及如何解决?

您可能缺少 IAM 权限,如果您使用CfnDeliveryStreamL1 构造,则必须自行处理。

考虑 L2 Firehose S3Bucket构造, “来自 Kinesis Data Firehose 交付 stream 的数据的 S3 存储桶目标。” 这是@aws-cdk/aws-kinesisfirehose-destinations-alpha package 中的实验性 API。

即使您想避免实验性 API,alpha 构造也很有用 - 请查看源代码以获取有关如何正确连接CfnDeliveryStream的提示。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM