AWS Network Security 2026
AWS VPC Flow Logs
Netzwerk-Traffic Analyse & Security
Athena, CloudWatch Insights, S3, Security Monitoring & Compliance. Network Forensics für AWS.
AthenaCloudWatchS3Security Lake
Was sind VPC Flow Logs?
VPC Flow Logs erfassen Informationen über IP-Datenverkehr in und aus Netzwerkschnittstellen in Ihrer VPC. Nutzen Sie sie für Sicherheitsanalysen, Netzwerk-Fehlerbehebung und Compliance-Monitoring.
Erfasste Daten
- • Source/Destination IP
- • Source/Destination Port
- • Protocol (TCP/UDP/ICMP)
- • Packets & Bytes
- • Start/End Time
- • Action (ACCEPT/REJECT)
Use Cases
- • DDoS Detection
- • Datenexfiltration
- • Compliance Auditing
- • Netzwerk-Troubleshooting
- • Kosten-Analyse
Terraform Setup
VPC Flow Logs mit Athena Integration
# VPC Flow Logs
resource "aws_flow_log" "vpc_flow_logs" {
vpc_id = aws_vpc.main.id
traffic_type = "ALL"
log_destination_type = "s3"
log_destination = aws_s3_bucket.flow_logs.arn
log_format = "$${version} $${account-id} $${interface-id} $${srcaddr} $${dstaddr} $${srcport} $${dstport} $${protocol} $${packets} $${bytes} $${start} $${end} $${action} $${log-status} $${vpc-id} $${subnet-id} $${instance-id} $${tcp-flags} $${type} $${pkt-srcaddr} $${pkt-dstaddr}"
destination_options {
file_format = "parquet"
per_hour_partition = true
hive_compatible_partitions = true
}
tags = {
Name = "vpc-flow-logs"
Compliance = "SOC2-ISO27001"
}
}
# S3 Bucket für Flow Logs
resource "aws_s3_bucket" "flow_logs" {
bucket = "company-vpc-flow-logs-$${data.aws_caller_identity.current.account_id}"
}
resource "aws_s3_bucket_lifecycle_configuration" "flow_logs" {
bucket = aws_s3_bucket.flow_logs.id
rule {
id = "archive-old-logs"
status = "Enabled"
transition {
days = 30
storage_class = "STANDARD_IA"
}
transition {
days = 90
storage_class = "GLACIER"
}
expiration {
days = 365
}
}
}Athena SQL Queries
Athena Table Definition
CREATE EXTERNAL TABLE IF NOT EXISTS vpc_flow_logs ( version int, account string, interfaceid string, sourceaddress string, destinationaddress string, sourceport int, destinationport int, protocol int, numpackets int, numbytes bigint, starttime int, endtime int, action string, logstatus string, vpcid string, subnetid string, instanceid string, tcpflags int, type string, pktsrcaddr string, pktdstaddr string ) PARTITIONED BY (region string, date_partition string) ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat' LOCATION 's3://company-vpc-flow-logs/AWSLogs/'
Security Analysis Queries
-- Top Talkers (Data Exfiltration Detection) SELECT sourceaddress, destinationaddress, destinationport, sum(numbytes) as total_bytes, count(*) as connection_count FROM vpc_flow_logs WHERE date_partition = '2026-03-29' AND action = 'ACCEPT' GROUP BY sourceaddress, destinationaddress, destinationport HAVING sum(numbytes) > 1000000000 -- > 1GB ORDER BY total_bytes DESC; -- Rejected Connections (Port Scan Detection) SELECT sourceaddress, count(distinct destinationport) as unique_ports, count(*) as total_attempts FROM vpc_flow_logs WHERE date_partition = '2026-03-29' AND action = 'REJECT' GROUP BY sourceaddress HAVING count(distinct destinationport) > 100 ORDER BY unique_ports DESC; -- Nacht-Traffic (Ungewöhnliche Zeiten) SELECT * FROM vpc_flow_logs WHERE date_partition = '2026-03-29' AND from_unixtime(starttime) BETWEEN '22:00:00' AND '06:00:00' AND action = 'ACCEPT' ORDER BY numbytes DESC;
VPC Flow Logs Analysis
Automatisieren Sie Ihre Netzwerk-Security Analyse.
Flow Logs Assessment