Large scale cyber attacks are now becoming normal in this age of interconnectivity. As we rely more and more on cloud technologies, companies are looking to tap into digital innovations to improve their businesses. Cyber attacks are costing companies millions of dollars of downtime not to mention the possibility of lawsuits whenever an attack occurs. It is imperative that security teams have the means to prevent, detect, and take actions to ensure that the security of their workloads in AWS are airtight.
Amazon GuardDuty was released during the 2017 re:Invent conference. Amazon GuardDuty is an agentless threat detection service that continuously monitors your AWS account and workloads. GuardDuty ingests data across multiple AWS services such as VPC flow logs, CloudTrail, and DNS logs, and uses machine learning, anomaly detection, and integrated threat intelligence to identify and prioritize potential attacks.
In this article, we will be using SNS topics and CloudWatch Events to automatically notify you via email of GuardDuty findings depending on their severity.
1. To start, we need to go to the GuardDuty console and click “Enable GuardDuty”.
2. Your GuardDuty console will probably be empty especially if you launch GuardDuty on a fresh account. We will
populate it later by using sample findings.
3. We need to create an SNS topic that will allow us to send notifications.
- Head over to SNS.
- Create a topic and name your topic.
- Click “Create topic”.
4. Create an SNS subscription for your topic.
- Specify the SNS topic you just created.
- Under protocol, choose Email.
- Enter the email address where you want to receive the CloudWatch events.
- Click “Create subscription”.
5. Now we need to create a CloudWatch Events rule to send events to the SNS topic.
- Head over to CloudWatch
- Look for the “Rules” tab and click it
6. Create a CloudWatch Events Rule
- Click “Create Rule”
- Toggle “Event Pattern”
- For the service name, look for GuardDuty
- For the event type, select GuardDuty finding
- Click “Edit” to modify the Event Pattern Preview and paste this JSON code. The code block will only alert you for findings with medium to high finding
7. Create Target
- On the “Targets” section, click “Add target” and specify the SNS topic you created.
- Under “Configure Input”, click on Input Transfer.
- Paste the following code for Input path and Input template then click “Configure Details”.
“You have a severity <severity> GuardDuty finding type <Finding_Type> in the <region> region.”
“For more details open the GuardDuty console at https://console.aws.amazon.com/guardduty/home?region=<region>#/findings?search=id%3D<Finding_ID>”
8. Configure Rule Details
- Name your Rule definition.
- Tick the “Enabled” box under state.
- Create Rule.
9. Populating your GuardDuty
- Head over to settings
- Under “Sample Findings” click “Generate Sample Findings”
- GuardDuty sends a notification within 5 minutes of a finding or in this case, you should receive an email after 5 minutes after you generate the sample finding
10. You will receive an email from AWS regarding the findings of GuardDuty.
In this tutorial, you have enabled Amazon GuardDuty, created an SNS topic and subscription, and configured a CloudWatch Events rule that will send a message to the SNS topic depending on the results of GuardDuty. You can adjust the CloudWatch rule and the target SNS configuration depending on your requirements.
In the next tutorial, we will discuss how to manage Amazon GuardDuty security findings across multiple accounts.