This function receives the records published to a SNS Topic by Amazon Inspector.It looks up an Inspector object based on its arn and type and then adds extra context to the final messages which are compressed and send to Sumo Logic HTTP source endpoint.
Lambda Setup((docs)[https://help.sumologic.com/Send-Data/Applications-and-Other-Data-Sources/Amazon-Inspector-App/01-Collect-Data-for-Amazon-Inspector])
- Login to the Amazon Console.
- Go to Application Integration > Simple Notification Service (SNS).
- On the SNS Dashboard, select Create topic.
- Enter a Topic name and a Display name, and click Create topic.
- To assign the following policy to this topic, select the topic, then under Advanced view, click Actions/Edit topic policy.
- Replace the existing text with the following:
{
"Version": "2008-10-17",
"Id": "inspector-sns-publish-policy",
"Statement": [
{
"Sid": "inspector-sns-publish-statement",
"Effect": "Allow",
"Principal": {
"Service": "inspector.amazonaws.com"
},
"Action": "SNS:Publish",
"Resource": "arn:aws:sns:*"
}
]
}
- Click Update policy.
- In the Amazon Console, go to Security, Identity & Compliance > Inspector.
- Select each assessment template you want to monitor.
- Expand each row and find the section called SNS topics.
- Click the Edit icon and select the SNS topic you created in the previous section.
- Click Save.
In the Amazon Console, go to Security, Identity & Compliance > IAM. Create a new role called Lambda-Inspector.
- In the Amazon Console, go to Compute > Lambda.
- Create a new function.
- On the Select blueprint page, select a Blank function.
- Select the SNS topic you created in Create an Amazon SNS Topic as trigger.
- Click Next.
- On the Configure function page, enter a name for the function.
- Go to https://github.com/SumoLogic/sumologic-aws-lambda/blob/master/inspector/python/inspector.py and copy and paste the sumologic-aws-lambda code into the field.
- Edit the code to enter the URL of the Sumo Logic endpoint that will receive data from the HTTP Source.
- Scroll down and configure the rest of the settings as follows: Memory (MB). 128. Timeout. 5 min. VPC. No VCP.
- Click Next.
- Click Create function.