0
votes

I have an AWS Lambda function that is invoked when an instance gets terminated and this the message is stored in Amazon CloudWatch Logs.

I want to extract and filter these log messages to get a particular ID. How can I extract the logs and filter it using Python?

1
If folks are interested in creating a venue for these types of questions, follow the proposal for a dedicated Cloud Computing site on StackExchange and up-vote some sample questions.John Rotenstein

1 Answers

1
votes

The easiest method might be to create a rule in Amazon CloudWatch Events that triggers an AWS Lambda function. The function automatically passes information relating to the instance that was terminated. You can write the Lambda function in Python.

Amazon CloudWatch Events

This way, your function is automatically triggered whenever an instance is terminated, rather than having to look through logs.