Without centralised logging, a security breach can go unnoticed for months because you have to manually piece together clues from hundreds of disconnected log files. Centralised logging pulls all your network traffic records, called VPC Flow Logs, and other event logs into one searchable place so you can spot attacks instantly. For the SCS-C02 exam, understanding how to design and implement this centralised system is critical because AWS tests whether you can choose the right services to collect, store, and analyse logs efficiently.
Jump to a section
A simple way to picture Centralized Logging, VPC Flow Logs, and Log Aggregation
12 seconds is all it takes for a fire alarm to force every employee out of a 40-storey office building. Each floor has its own safety warden who keeps a handwritten log of who left, when, and through which stairwell. One warden uses a spiral notebook, another uses a tablet, and a third scribbles on napkins. When the fire chief arrives, she doesn't want to hunt through 40 different logs stored in different formats across the building. She wants one central command centre where she can see, in real time, that floor 27 is still showing 3 people unaccounted for. That centralised view is her logging system. The individual wardens' records are like VPC Flow Logs — they capture who communicated (which EC2 instance talked to which), at what time, and over which protocol. If the fire chief had to run floor-to-floor collecting napkins, she would miss the critical window to rescue those 3 people. Centralised logging collects all those separate flow logs into one searchable, alert-enabled dashboard called Amazon CloudWatch Logs or Amazon OpenSearch Service. Without it, the security team chasing a network intrusion would waste hours correlating timestamps from scattered log sources, and the attacker would already be gone. The emergency evacuation scenario makes the need obvious: speed and completeness depend on aggregation, not distribution.
Let us start with the core idea: cloud logging is the act of recording events that happen inside your AWS environment. Think of it like a security camera for your virtual network. Every time an EC2 instance — an Amazon Elastic Compute Cloud instance, which is a virtual server — sends or receives a packet of data, a record can be created. That record is a log entry. AWS offers several ways to capture these entries, and the most important one for the SCS-C02 exam is called VPC Flow Logs.
VPC stands for Virtual Private Cloud. It is your own isolated section of the AWS cloud where you launch your resources. A VPC Flow Log captures metadata about the network traffic flowing in and out of your VPC. Metadata means it records who talked to whom, the port number used, the protocol (TCP or UDP), and the action taken (ACCEPT or REJECT). It does not record the actual content of the communication — just the envelope information. This is crucial for security because if an attacker tries to probe your network, a rejected connection will appear in the flow log. You can enable VPC Flow Logs at three levels: the VPC itself, a specific subnet, or a specific network interface attached to an EC2 instance. Each level gives you more granularity.
Now, where do those logs go? AWS lets you publish VPC Flow Logs to three destinations:
Amazon CloudWatch Logs: a central log management service where you can store, monitor, and set alarms on log data.
Amazon Simple Storage Service (S3): a scalable object storage service for long-term archival.
Amazon Kinesis Data Firehose: a service for streaming log data to real-time analytics tools.
Centralised logging means you choose one of these destinations — usually CloudWatch Logs or S3 — and send all your VPC Flow Logs, plus other logs like AWS CloudTrail (API activity logs) and AWS Config (resource configuration change logs), to that single location. You then use a tool like Amazon OpenSearch Service (a managed version of the Elasticsearch search engine) or Amazon Athena (an interactive query service) to search and analyse the logs. Without centralisation, you would have to log into each EC2 instance separately, check its own local log files, and manually correlate timestamps — a nightmare during an incident response.
The concept of log aggregation is the process of collecting logs from multiple sources into a single repository. AWS services like Amazon CloudWatch Logs and Amazon S3 are the aggregation points. You can also use third-party solutions like Splunk or the ELK Stack (Elasticsearch, Logstash, Kibana) if you deploy them on EC2. The exam expects you to know when to use each destination based on cost, query speed, and retention requirements.
Why does centralised logging matter for security? Imagine a scenario where an employee mistakenly exposes an S3 bucket to the public internet. A VPC Flow Log would show traffic from unknown IP addresses reaching that bucket. CloudTrail would show who made the bucket policy change. By bringing both logs into one dashboard, a security analyst can quickly correlate: "Someone changed the bucket policy at 2:00 PM, and by 2:05 PM, an attacker from IP 203.0.113.5 downloaded 500 MB of data." Without centralisation, the analyst would have to dig through separate services, wasting precious minutes.
In summary, centralised logging with VPC Flow Logs gives you visibility into your network traffic, helps you detect anomalies, and provides the evidence needed for forensic investigations. For the SCS-C02 exam, you need to know how to enable VPC Flow Logs, where to publish them, and how to query them using services like Amazon Athena.
Enable VPC Flow Logs
Go to the VPC console in AWS, select your VPC, and choose 'Create flow log'. Choose the destination (CloudWatch Logs, S3, or Kinesis). This action tells AWS to start capturing metadata about every network packet that enters or leaves the VPC.
Configure the Log Destination
If you choose CloudWatch Logs, create a log group and specify an IAM role that grants permission to publish logs. If you choose S3, specify the bucket and optionally a prefix to organise the log files. The destination determines how you can search and analyse the logs later.
Verify the Log Format
Once logs start flowing, open one record to check the fields. The default format includes version, account-id, interface-id, srcaddr, dstaddr, srcport, dstport, protocol, packets, bytes, start, end, action, and log-status. Knowing these fields helps you write accurate queries.
Query the Logs with Amazon Athena
If logs are in S3, create a table in Athena using a Glue crawler or manual schema. Then write a SELECT statement with conditions like 'action = REJECT' to find blocked traffic. This step is vital for security analysis because you can identify unauthorised access attempts.
Set Up Alarms and Dashboards
Use Amazon CloudWatch Logs Insights to create metrics filters that count occurrences of specific patterns (e.g., too many REJECT actions). Attach a CloudWatch alarm to that metric to trigger an SNS notification or a Lambda function. This automates the alerting process so you do not have to watch logs manually.
Automate Log Aggregation Across Accounts
Use AWS Organizations with a central logging account. Configure each member account to send VPC Flow Logs to an S3 bucket in the central account. Then set up AWS CloudTrail and AWS Config in the central account to receive logs from all accounts. This creates a single pane of glass for the entire organisation.
Meet Priya, the newly hired cloud security engineer at FinSecure, a mid-sized financial services company. FinSecure runs a three-tier web application on AWS: a load balancer in a public subnet, application servers in private subnets, and a database in a private subnet. Priya's first task is to investigate a suspicious spike in outbound traffic reported by the finance team. She notices that a single EC2 instance has been sending 10 GB of data per hour to an IP address in a foreign country—an abnormal pattern.
Priya starts by enabling VPC Flow Logs at the subnet level for the private subnets. She configures the logs to be published to Amazon S3 because the finance team requires logs to be retained for seven years for compliance. She then uses Amazon Athena to query the logs directly from S3. She writes a simple SQL query like: SELECT * FROM vpc_flow_logs WHERE src_ip = '10.0.1.25' AND bytes > 1000000. The query returns that the source EC2 instance is communicating over port 443 (HTTPS) to a known malicious IP address listed in threat intelligence feeds.
Now Priya needs to dig deeper. She enables AWS CloudTrail to capture API calls made by any IAM user or role in the account. She finds that a developer's access keys were used to modify the security group rules for that instance, allowing outbound traffic to any IP address. Without centralised logging, Priya would have to separately check CloudTrail logs, VPC Flow Logs, and Amazon GuardDuty findings. Instead, she uses Amazon CloudWatch Logs Insights to aggregate logs from multiple sources. She sets up a dashboard that shows VPC Flow Logs, CloudTrail events, and GuardDuty alerts side by side.
The step-by-step actions Priya took:
Enabled VPC Flow Logs on the suspect subnet and published them to S3.
Enabled CloudTrail in the same AWS Region to log all management events.
Created an Athena table on top of the VPC Flow Logs in S3 to run SQL queries.
Set up a CloudWatch Logs Insights query group that cross-references VPC Flow Logs and CloudTrail logs.
Built an automated alarm in CloudWatch that triggers an SNS notification if outbound traffic exceeds 5 GB/hour from any single EC2 instance.
After rectifying the issue—rotating the compromised access keys and restricting security group rules—Priya creates a playbook for future incidents. The playbook includes steps to enable VPC Flow Logs on all new VPCs, aggregate logs into a central Amazon S3 bucket, and use Amazon Macie to scan S3 objects for sensitive data that might have been exfiltrated. FinSecure now has a centralised logging pipeline that reduces incident detection time from days to minutes.
On the SCS-C02 exam, Centralised Logging and VPC Flow Logs appear in several question formats. The exam loves to test your ability to choose the correct log destination, understand log format fields, and identify what data each AWS service captures. You must be precise because the answer choices often differ by only one word.
Key exam topics to know cold:
VPC Flow Logs fields: Know that the default format includes version, account-id, interface-id, srcaddr, dstaddr, srcport, dstport, protocol, packets, bytes, start, end, action (ACCEPT/REJECT), and log-status. You will be asked which field reveals whether traffic was allowed or denied.
VPC Flow Logs limitations: They capture metadata only—not packet contents. They do not capture traffic to the Amazon DNS server (169.254.169.253) or to the Amazon DHCP server (169.254.169.254) by default. They can be enabled at the VPC, subnet, or network interface level; higher levels are easier to manage but less granular.
Log destinations: You need to know the use case for each destination. CloudWatch Logs is best for real-time monitoring and alarms at the cost of per-GB ingestion fees. S3 is cheapest for long-term storage, especially with S3 Lifecycle policies to move older logs to Glacier. Kinesis Firehose is for streaming logs to analytics tools like Amazon OpenSearch Service.
Aggregation services: Amazon CloudWatch Logs Insights allows querying multiple log groups. Amazon OpenSearch Service (formerly Elasticsearch) is for advanced visualisation and log analytics. Amazon Athena is best for querying logs stored in S3 using standard SQL. The exam will ask which service to use based on whether the logs are in S3 or CloudWatch Logs.
Common trap patterns: The exam frequently includes a scenario where logs are being sent to CloudWatch Logs but the question asks about long-term retention (the answer is S3). Another trap: a question says “enable VPC Flow Logs” but does not specify the log destination—the correct answer is to choose CloudWatch Logs because that is the default option in the AWS Console. Another trap: confusing VPC Flow Logs with AWS CloudTrail—CloudTrail captures API calls, while VPC Flow Logs capture network traffic metadata.
Permissions required: VPC Flow Logs must be created with a service-linked role named AWSServiceRoleForVPCFlowLogs. The exam will test whether the IAM policy has the correct permissions, such as logs:CreateLogGroup, logs:CreateLogStream, and logs:PutLogEvents.
Answers to memorise: “Which service allows you to query VPC Flow Logs stored in S3?” Amazon Athena. “Which log destination provides the fastest search for real-time alerting?” CloudWatch Logs. “What is the default format field that indicates whether traffic was accepted or rejected?” action.
Focus on these patterns and you will handle the VPC Flow Logs questions confidently on exam day.
VPC Flow Logs capture metadata about network traffic, not the content of the traffic itself.
You can publish VPC Flow Logs to CloudWatch Logs, S3, or Kinesis Firehose, each with different cost and query characteristics.
Centralised logging aggregates logs from multiple sources (VPC Flow Logs, CloudTrail, Config) into one searchable location for faster incident response.
The default VPC Flow Log format includes an 'action' field that shows ACCEPT or REJECT for each record.
Amazon Athena allows you to run standard SQL queries directly on VPC Flow Logs stored in S3.
Enable VPC Flow Logs at the VPC level to capture all traffic across all subnets in one go, unless you need granular per-subnet or per-instance logs.
These come up on the exam all the time. Here's how to tell them apart.
VPC Flow Logs
Captures metadata about network traffic (packets)
Records who talked to whom over which port and protocol
Shows ACCEPT or REJECT for each connection attempt
AWS CloudTrail
Captures metadata about API calls (actions taken on AWS resources)
Records who made the request, what action was taken, and when
Shows the source IP of the API caller and the response code
CloudWatch Logs
Designed for real-time log ingestion and monitoring
Supports metric filters and alarms directly on logs
Logs are stored in log groups with indexed streams
Amazon S3
Designed for durable, low-cost long-term storage
Best for archival with S3 Lifecycle policies to Glacier
Queries require Athena or other external tools
Amazon Athena
Serverless SQL query service for data in S3
No infrastructure to manage, pay per query scanned
Best for ad-hoc analysis of large datasets like logs
Amazon OpenSearch Service
Managed analytics service with search and visualisation capabilities
Requires provisioning cluster instances with persistent storage
Best for real-time dashboards and interactive log exploration
VPC Flow Logs - Subnet Level
Captures traffic entering and leaving the subnet
More granular, can isolate traffic per subnet
Creates multiple log streams for each subnet
VPC Flow Logs - VPC Level
Captures all traffic entering and leaving the entire VPC
Less granular, one log stream for the whole VPC
Simpler management, single point to enable logging
Mistake
VPC Flow Logs capture the actual data content of network traffic, so you can see what commands an attacker sent.
Correct
VPC Flow Logs capture only metadata — source IP, destination IP, port, protocol, and action. They never record the payload of the communication.
Beginners confuse network monitoring with deep packet inspection. In exam questions, you must recognise that if the scenario requires seeing the content of a communication, you need a different service like Amazon Inspector or a third-party agent on the EC2 instance.
Mistake
You can enable VPC Flow Logs only on the entire VPC, and they automatically capture all traffic within the VPC.
Correct
VPC Flow Logs can be enabled at the VPC, subnet, or network interface level. They only capture traffic that enters or leaves that level — for example, a subnet-level flow log will not show traffic between two instances within the same subnet unless you also enable it on the subnet or their interfaces.
Marketing material often shows 'VPC Flow Logs' as a single switch, leading users to believe it is a blanket coverage. The exam tests knowledge of the hierarchy and limitations.
Mistake
The default format of a VPC Flow Log record includes the account ID and interface ID, so you can always identify which account generated the log.
Correct
The default format does include account-id and interface-id, but the log record only shows the account ID of the owner of the network interface. In cross-account scenarios, you must use a centralised logging account to aggregate logs from multiple accounts, and the interface ID will still reference the original account.
Students assume the 'account-id' field identifies the log source account, but AWS documentation clarifies it is the owner of the interface. This is a subtle nuance the exam tests in multi-account architectures.
Mistake
If you enable VPC Flow Logs on a subnet, and then enable them on the VPC, you get double the logs and double the cost.
Correct
Enabling flow logs at different levels creates separate log streams with overlapping traffic. You will not be charged for the same packet twice, but you will have duplicate metadata records if you query both streams. The exam recommends enabling at one level (usually the VPC) to avoid confusion.
The 'double logging' concept exists in many monitoring systems, but AWS VPC Flow Logs are additive — each level captures traffic at that boundary independently, so yes, you get separate records, but they are not deduplicated automatically.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Go to the VPC console, select your VPC, click 'Actions' > 'Create flow log'. Choose a destination (CloudWatch Logs or S3) and the IAM role. The logs will start appearing within a few minutes.
CloudWatch Logs is better for real-time monitoring because you can set alarms and query quickly. S3 is cheaper for long-term storage. Use CloudWatch Logs for operational needs and S3 for compliance archival.
Yes, use Amazon Athena to run SQL queries on VPC Flow Logs stored in S3. Create a table schema matching the log format, then query it with standard SQL.
The default format includes: version, account-id, interface-id, srcaddr, dstaddr, srcport, dstport, protocol, packets, bytes, start, end, action, and log-status. The 'action' field shows either ACCEPT or REJECT.
Yes. If you store logs in CloudWatch Logs, you can encrypt them with an AWS KMS key. If you store them in S3, you can use S3 server-side encryption. Encryption at rest is optional but recommended for sensitive data.
Yes, but only if you enable flow logs at the subnet or network interface level. VPC-level flow logs capture traffic that enters or leaves the VPC, not internal subnet traffic.
You've finished Centralized Logging, VPC Flow Logs, and Log Aggregation. Continue through the SCS-C02 study guide to build a complete picture of the exam.
Done with this chapter?