How to send log data from Lambda to EC2-hosted ElasticSearch

0

I have created a lambda and set the kinesis data stream as a trigger. When I send a log to the kinesis data stream, I can see lambda being triggered and I can view the logs on cloud watch.

I have reserved an EC2 instance and installed elastic search and listening at 9200 port (ex say some IP like https://11.22.333.44:9200/). Now I need to send the data from lambda to elastic search which I have installed in an EC2 instance. When I clicked on the destination I do not have a way to reach EC2 instance hosting my Elastic search.

Note: I do not want to use "Amazon OpenSearch Service".

2개 답변
2

Hi,

I would take inspiration from this: https://aws.amazon.com/blogs/compute/using-aws-lambda-extensions-to-send-logs-to-custom-destinations/, which uses Lambda extensions, and perform http request against the elastic endpoint hosted in ec2.

Hope it helps ;)

profile picture
전문가
답변함 일 년 전
0

As your Lambda logs are in CloudWatch, you can install the Elastic Agent on your EC2 and use the ElasticSearch CloudWatch integration, specifying the LogGroup prefixes to pull.

See https://www.elastic.co/guide/en/fleet/current/elastic-agent-installation.html and https://docs.elastic.co/en/integrations/aws.

전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠