

With these tutorials, we explained the VPC flow logs and how to analyze them to track the traffic on your instance for better data security management and detecting malicious software and events, which helps teams identify and fix them.įor more information about VPC flow logs, visit Amazon’s official page for VPC flow logs to learn more about it, troubleshooting, and how to publish on Amazon S3 and CloudWatch. WHERE destinationport = 443 AND date > current_date - interval '7' dayīy increasing the popularity of AWS environments, it becomes more complex, which requires more enhanced tools and techniques. We use this query as it counts the number of packets received on HTTPS port 443. Now suppose you want to check the servers which have the highest number of HTTPS requests. By applying these queries you get the top 10 IP addresses that are transferred. Let’s assume that your application serves requests on a specific port. SELECTĪnother scenario is to monitor traffic on web app ports. Here 22 is the port of SSH, while 3389 is for RDP. We run the query below to get the activity on the SSH and RDP ports.
#Vpc flow logs windows
RDP is used for Windows while SSH is for AWS linux instances. Now, there are many use cases scenarios for analyzing flow logs in security.įor example, to monitor SSH and RDP traffic. Now, you need to run the above query in the Athena console, which will register a table called vpc_flow_logs. LOCATION 's3://example_bucket/prefix/AWSLogs// to the address of the log you want to analyze.
#Vpc flow logs code
Let’s start by configuring amazon Athena to query data to try different security scenarios.Ĭopy this DDL code into the Athena console CREATE EXTERNAL TABLE IF NOT EXISTS vpc_flow_logs ( You can access them through the CloudWatch interface, then select the log group, then the log stream to view itĪfter creating the flow logs, gaining access to them, and publishing them to Amazon CloudWatch Logs, you can analyze these logs using Amazon S3 to provide scalability. Analyzing VPC Flow Logs for Security Step by Stepīefore beginning, you have to access your VPC flow logs. So using flow logs, we can analyze these ports to maximize security and detect suspicious activities.

These ports can only be accessed from trusted sources. You can monitor remote logins from ports like SSH and RDP. Network ACLs act as a network firewall from subnets that controls the traffic movement. It is important to understand the difference between security groups and network ACLs in security groups, it acts as a firewall application that allows network traffic to go in and out. We also can use the flow logs to diagnose and troubleshoot the connection issues. Also, we monitor the traffic flows to build confidence between ACLs. Using VPC flow logs, you can create alarms for unauthorized IP addresses and the unauthorized destination port that is trying to redirect you, as this will be malicious software trying to gain access.īy analyzing VPC flow logs, we can detect threats by monitoring port scanning. How Can Flow Logs Help in Security?įlow logs can help you analyze all the requests that come in and either accept or reject them, which improves Access Control List (ACL) rules. Using a flow log, you can analyze the region where you get the most traffic and detect if specific traffic is not properly connected and reaches the instancīefore the introduction of VPC flow logs, customers collected network flow logs by installing agents on their instances, limiting them in terms of how they could view the network flows. Flow logs are collected outside your network traffic, which doesn’t affect your network performance.Įvery flow log is published to Amazon CloudWatch Logs to easily retrieve its data and help monitor the traffic for your instance and determine the direction of this traffic and what you can do with it. From VPC flow logging information, you get the traffic flows within VPC, subnets, or ENIs.

So flow logs can work as the main source of information to the network in your VPC. What Are VPC Flow Logs?Īmazon VPC flow logs allow you to track and analyze all the IP addresses coming in and out from the network interface in the VPC. It is an easy and interactive query service perfect for analyzing flow logs with standard SQL. Then we will explain how to enable VPC flow logs and how to access them through CloudWatch.Īlso, we’ll go through some use cases for analyzing VPC flow logs via Amazon Athena. We’ll discuss ways to defend instances from malicious software and unauthorized traffic. We’ll also list some use cases of how you can use flow logs to secure your instances. We will go through the definition of the VPC flow logs and what they are. In this article we will go through the technical side of analyzing AWS VPC flow logs for security and intrusion.

How to Analyze VPC Flow Logs for Security
