遵循本指南并创建 Kinesis Firehose Stream。
我已按照指南进行操作,当我开始创建订阅过滤器(步骤 12)时,我在尝试发送到 S3 时遇到此错误:
调用 PutSubscriptionFilter 操作时发生错误 (InvalidParameterException):无法将测试消息传递到指定的 Firehose 流。检查给定的 Firehose 流是否处于 ACTIVE 状态。
我可以确认流处于活动状态,并且我可以通过控制台发送测试数据,并且它按预期到达 S3。
这是我正在运行的命令(更改了我的帐户 ID):
aws logs put-subscription-filter --log-group-name "myLogGroup" --filter-name "Destination" --filter-pattern "{$.userIdentity.type = Root}" --destination-arn "arn:aws:firehose:ap-southeast-1:1234567890:deliverystream/my-delivery-stream" --role-arn "arn:aws:iam::1234567890:role/CWLtoKinesisFirehoseRole"
我已经检查了受信任的实体,并且该角色具有日志和 Firehose 的权限。有什么想法吗?
我确信您已经知道如何配置日志订阅过滤器,因此无需在我的答案中添加步骤
希望这有助于解决您的问题。
这是 Cloudwatch Logs 和 Firehose 流之间的权限问题。您的角色和政策可能是错误的。
我按照 this doc 在需要的地方用
kinesis
替换 firehose
,最终得到:
此 IAM 政策:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "firehose:PutRecord",
"Resource": "arn:aws:firehose:REGION:ACCOUNT_ID:deliverystream/STREAM_NAME"
}]
}
一个 IAM 角色:
包括上面创建的策略
具有以下信任关系:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {
"Service": "logs.REGION.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringLike": {
"aws:SourceArn": "arn:aws:logs:REGION:ACCOUNT_ID:*"
}
}
}]
}
在创建日志组目标时选择 IAM 角色
别忘了更换
REGION
、ACCOUNT_ID
、STREAM_NAME
。