DDoS Protection on AWS
AWS ป้องกัน DDoS แบบ multi-layered — ผสมหลายบริการเพื่อป้องกันทั้ง network layer และ application layer
AWS Shield Standard
FREE สำหรับลูกค้า AWS ทุกคน เปิดอัตโนมัติ — ป้องกัน SYN/UDP floods, reflection attacks และ DDoS ระดับ Layer 3/4 อื่นๆ
AWS Shield Advanced
$3,000/เดือน/องค์กร — มี 24/7 DDoS Response Team (DRT), ป้องกัน EC2 / ELB / CloudFront / Global Accelerator / Route 53 จากการโจมตีที่ซับซ้อน + ป้องกันค่าใช้จ่ายที่พุ่งสูงจาก DDoS (DDoS cost protection)
AWS WAF
Web Application Firewall — กรอง request ตามกฎ (rules) ที่กำหนด ป้องกัน SQL injection, XSS, geo-blocking ฯลฯ
CloudFront + Route 53
ใช้ edge network ของ AWS กระจายโหลดทั่วโลก — ช่วย absorb traffic spike และเป็น first line of defense
AWS WAF (Web Application Firewall)
AWS WAF ปกป้องเว็บแอปพลิเคชันจากช่องโหว่ Layer 7 (HTTP) — เช่น SQL injection, XSS, bot attack
- Deploy บน Application Load Balancer (ALB), API Gateway, หรือ CloudFront
- กำหนด Web ACL (Access Control List) ที่มี rules ตามต้องการ
- ปกป้องเฉพาะ Layer 7 (HTTP) — ไม่ใช่ Layer 3/4 (DDoS ใช้ Shield)
Rules ที่ใช้บ่อย
IP addresses, HTTP headers, HTTP body, URI strings — match แบบ exact หรือ regex
Attack Protection
SQL injection, Cross-Site Scripting (XSS), common web exploits
Size Constraints
จำกัดขนาด request — ป้องกันการส่ง payload ใหญ่ผิดปกติ
Geo-match
บล็อกหรืออนุญาต traffic จากบางประเทศ (geo-blocking)
Rate-based Rules
จำกัดจำนวน request ต่อ IP ในช่วงเวลา — ป้องกัน brute force, scraping
Penetration Testing on AWS
AWS อนุญาตให้ทำ penetration testing โดยไม่ต้องขออนุญาตล่วงหน้า สำหรับ 8 services เท่านั้น
Services ที่อนุญาต
EC2 / NAT Gateway / ELB, RDS, CloudFront, Aurora, API Gateway, Lambda + Lambda@Edge, Lightsail, Elastic Beanstalk
กิจกรรมที่ห้าม
DNS zone walking ผ่าน Route 53, DoS / DDoS / simulated DDoS, port flooding, protocol flooding, request flooding (login flooding, API flooding)
Encryption: At Rest vs In Transit
Encryption At Rest
ข้อมูลที่ เก็บอยู่บน disk — เช่น Hard Disk, RDS database, S3 Glacier — เข้ารหัสด้วย encryption key เพื่อกันคนเอา disk ไปอ่าน
Encryption In Transit (in flight)
ข้อมูลที่ กำลังเดินทางผ่าน network — เช่น on-premise → AWS, EC2 → DynamoDB — ใช้ TLS/SSL กันการดักฟัง (eavesdropping, MITM)
AWS KMS (Key Management Service)
AWS KMS เป็นบริการที่ให้ AWS ช่วยจัดการ encryption keys — ใช้ผสานกับบริการอื่นๆ เพื่อเข้ารหัสข้อมูลได้ง่าย
Encryption Opt-in (เลือกเปิดเอง)
EBS volumes, S3 (SSE), Redshift, RDS, EFS — default ไม่ได้เข้ารหัส ต้องเปิดเอง
Encryption Automatic (เปิดให้เลย)
CloudTrail Logs, S3 Glacier, Storage Gateway — AWS เข้ารหัสอัตโนมัติทุกบริการเลย ปิดไม่ได้
KMS มี CMK (Customer Master Keys) 4 ประเภท:
Customer Managed CMK
คุณสร้างเอง + กำหนด policy + rotate ได้เอง — ควบคุมเต็มที่ (มีค่าใช้จ่าย $1/เดือน/key)
AWS Managed CMK
AWS สร้างให้สำหรับใช้กับ service ของ AWS — เช่น aws/s3, aws/ebs, aws/rds (ฟรี)
AWS Owned CMK
AWS เป็นเจ้าของ ใช้ภายในของ AWS เอง — คุณ ดูไม่ได้ และไม่ต้องจัดการ (ฟรี)
CloudHSM Keys
Custom keystore ที่เชื่อมไปยัง CloudHSM cluster ของคุณ — สำหรับงานที่ต้อง FIPS 140-2 Level 3
AWS CloudHSM
AWS CloudHSM = Hardware Security Module — ฮาร์ดแวร์เฉพาะ tamper-resistant ที่ใช้จัดเก็บ + ประมวลผล encryption keys
- AWS จัดเตรียม hardware ให้ — แต่คุณเป็นคนจัดการ keys (ไม่ใช่ AWS)
- ผ่านมาตรฐาน FIPS 140-2 Level 3 — สูงกว่า KMS
- เหมาะกับ workload ที่กฎหมาย/compliance บังคับให้ใช้ HSM ฮาร์ดแวร์
- สามารถ integrate กับ KMS ผ่าน custom keystore ได้
KMS
Software-based — AWS เป็นคนจัดการ underlying — ใช้ง่าย ราคาถูก เหมาะกับ workload ทั่วไป
CloudHSM
Hardware-based — คุณเป็นคนจัดการ keys — เหมาะกับ workload ที่ต้องการ compliance สูงและความเป็นส่วนตัวเต็มที่
AWS Certificate Manager (ACM)
AWS Certificate Manager (ACM) ช่วย provision, manage, deploy SSL/TLS certificates เพื่อทำ HTTPS (in-flight encryption)
- รองรับทั้ง Public และ Private TLS certificates
- ฟรี สำหรับ public TLS certificates
- Auto-renewal — ต่ออายุให้อัตโนมัติ ไม่ต้องจัดการเอง
- Integrate กับ Elastic Load Balancer (ELB), CloudFront, API Gateway
AWS Secrets Manager
AWS Secrets Manager เก็บความลับเช่น database password, API key — ดีกว่าฝังในโค้ดหรือ config
- บังคับ rotation ทุก X วันได้
- Auto-generate รหัสใหม่ผ่าน Lambda function
- Integrate กับ RDS (MySQL, PostgreSQL, Aurora) โดยตรง
- Secrets ถูกเข้ารหัสด้วย KMS เสมอ
AWS Artifact
AWS Artifact เป็น portal สำหรับดาวน์โหลดเอกสาร compliance ของ AWS — ไม่ใช่ "service" ในความหมายเทคนิค
Artifact Reports
ดาวน์โหลดรายงาน security + compliance ของ AWS เช่น ISO, PCI, SOC reports — สำหรับใช้ตรวจสอบกับ auditor ของคุณ
Artifact Agreements
ตรวจสอบ / ยอมรับ / ติดตาม agreements กับ AWS เช่น BAA (Business Associate Agreement สำหรับ HIPAA)
Amazon GuardDuty
Amazon GuardDuty ใช้ Machine Learning + anomaly detection + 3rd party threat intel เพื่อตรวจจับ threat ใน account อย่างชาญฉลาด — เปิดใช้แค่คลิกเดียว (มี 30-day trial)
CloudTrail Logs
ตรวจ API call ที่ผิดปกติ — เช่น user สร้าง resource ในประเทศที่ไม่เคยใช้
VPC Flow Logs
ตรวจ traffic / IP ที่ผิดปกติ — เช่น instance สื่อสารกับ malicious IP ที่ AWS รู้จัก
DNS Logs
ตรวจ EC2 ที่อาจถูก compromise แล้วใช้ DNS query ขโมยข้อมูลออกไป
Amazon Inspector
Amazon Inspector ทำ automated security assessment ให้ EC2 — วิเคราะห์ OS ที่กำลังรันว่ามี vulnerabilities หรือ unintended network exposure ไหม
- Target = EC2 instances (รวม container image และ Lambda function ในเวอร์ชันใหม่)
- ต้องติดตั้ง Inspector Agent บน OS ของ instance
- วิเคราะห์ OS vulnerabilities และ network reachability
- Output = vulnerability report เรียงตามความรุนแรง
AWS Config
AWS Config ใช้ audit + record compliance ของ resource ในบัญชีของคุณตลอดเวลา (รายละเอียดเต็มอยู่ในหัวข้อ Cloud Monitoring)
- Track configuration changes ของแต่ละ resource ตามกาลเวลา
- ทำงานต่อ region — แต่ aggregate ข้ามหลาย region / account ได้
- Integrate กับ Security Hub ได้ (เป็น prerequisite ของ Security Hub)
Amazon Macie
Amazon Macie เป็นบริการ fully managed data security + privacy — ใช้ Machine Learning + pattern matching ค้นหาและปกป้องข้อมูลละเอียดอ่อนใน S3
- Specialized: ตรวจ PII (Personally Identifiable Information) ใน S3 buckets
- ตรวจชื่อ ที่อยู่ เลขบัตรเครดิต เลขบัตรประชาชน ฯลฯ
- แจ้งเตือนผ่าน CloudWatch Events / EventBridge
AWS Security Hub
AWS Security Hub = ศูนย์กลาง security ที่รวม alert จากหลายบริการ + หลาย account — ดูภาพรวมความปลอดภัยทั้งองค์กรได้จากที่เดียว
- รวม alert จาก GuardDuty, Inspector, Macie, IAM Access Analyzer, Systems Manager, Firewall Manager และ partner products
- ต้องเปิดใช้ AWS Config ก่อน (prerequisite)
- เหมาะกับ multi-account environments (AWS Organizations)
Amazon Detective
GuardDuty / Macie / Security Hub ตรวจพบปัญหา — แต่ Amazon Detective ใช้ วิเคราะห์ + สอบสวน root cause ของปัญหานั้น
- ใช้ Machine Learning + graph theory สร้างภาพความสัมพันธ์ของ event
- ดึงข้อมูลจาก VPC Flow Logs + CloudTrail + GuardDuty
- ช่วยให้ analyst ทำ root cause analysis ได้รวดเร็ว
AWS Abuse
ถ้าพบว่า resource ของ AWS ถูกใช้ในทางที่ผิด สามารถรายงานผ่าน AWS Abuse ได้
- Spam — email spam ที่มาจาก IP ของ AWS
- Port scanning, DoS / DDoS attack, intrusion attempt
- Hosting copyrighted หรือ objectionable content
- การแพร่กระจาย malware
Root User Privileges
Root user = เจ้าของ AWS account ที่มีสิทธิ์ เต็มที่ — ห้ามใช้ในงานประจำ ควร lock away access keys และเปิด MFA ทันที
งานต่อไปนี้ มีแต่ root user เท่านั้นที่ทำได้:
- Change account settings (name, email, root password, root access keys)
- View tax invoices
- Close AWS account
- Restore IAM permissions เมื่อ admin user เผลอ revoke ตัวเอง
- Change/cancel AWS Support Plan
- Register เป็น seller ใน Reserved Instance Marketplace
- Configure S3 MFA Delete
- Edit S3 bucket policy ที่มี invalid VPC ID
- Sign up สำหรับ AWS GovCloud
Summary
Shield Standard / Advanced
ป้องกัน DDoS — Standard ฟรี, Advanced $3,000/เดือน + DRT 24/7
WAF
Layer 7 firewall — ป้องกัน SQL injection, XSS, geo-block
KMS
จัดการ encryption keys (software-based, AWS ช่วยจัดการ)
CloudHSM
Hardware HSM, FIPS 140-2 Level 3 — คุณจัดการ keys เอง
ACM
Provision SSL/TLS certificates — public ฟรี + auto-renewal
Secrets Manager
เก็บ + rotate secrets อัตโนมัติ (RDS integration)
Artifact
Portal โหลดเอกสาร compliance (ISO, PCI, SOC, BAA)
GuardDuty
Threat detection ด้วย ML จาก CloudTrail + VPC Flow + DNS Logs
Inspector
Vulnerability assessment สำหรับ EC2 (ต้อง install agent)
Macie
ค้นหา PII ใน S3 ด้วย ML
Security Hub
ศูนย์กลาง security ที่รวม alert จากบริการอื่นๆ
Detective
สอบสวน root cause ด้วย ML + graph
Config
Audit + record compliance per region
Abuse
รายงาน resource ที่ถูกใช้ในทางผิด