Cloudwatch logs to Opensearch subscriptions

0

Hi,

Im trying to set up cloudwatch logs to opensearch via: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_OpenSearch_Stream.html

  • Actions, Subscription filters, Create Amazon OpenSearch Service subscription filter

But the lambda is getting log errors for permissions.

The error is:

 "errorMessage": "{\"statusCode\":403,\"responseBody\":{\"error\":{\"root_cause\":[{\"type\":\"security_exception\",\"reason\":\"no permissions for [indices:data/write/bulk] and User [name=arn:aws:iam::xxxx:role/test-cloudwatch-2-opensearch, backend_roles=[arn:aws:iam::xxxx:role/test-cloudwatch-2-opensearch], requestedTenant=null]\"}],\"type\":\"security_exception\",\"reason\":\"no permissions for [indices:data/write/bulk] and User [name=arn:aws:iam::xxxx:role/test-cloudwatch-2-opensearch, backend_roles=[arn:aws:iam::xxxx:role/test-cloudwatch-2-opensearch], requestedTenant=null]\"},\"status\":403}}"

I ended up with the below IAM

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "es:*"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:es:eu-west-2:xxxx:domain/xxxx/*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeNetworkInterfaces",
                "ec2:CreateNetworkInterface",
                "ec2:DeleteNetworkInterface",
                "ec2:DescribeInstances",
                "ec2:AttachNetworkInterface"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": "*"
        }
    ]
}
oc
已提问 7 个月前258 查看次数
1 回答
1
已接受的回答

Updated the opensearch cluster to add the lambda role a backend user. That resolved it!

oc
已回答 7 个月前
profile picture
专家
已审核 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则