Skip to Content
Asterrr's Handbook
3 · Infrastructure security

IDS, IPS and Host-Based Security

Where network controls stop and host agents, Network Firewall and IMDSv2 take over. Source/destination check, file integrity, metadata hardening.

Exam tasks: 3.3 (network controls that permit or prevent traffic: security groups, network ACLs, Network Firewall; north/south and east/west protection)

The decision: does the requirement need payload or process visibility, and must it block (IPS, inline appliance) or only detect?

Security groups and network ACLs decide on packet headers only (address, port, protocol). They cannot read payloads. Payload inspection, file integrity checks and process-level control need a host agent or an inline appliance such as AWS Network Firewall.

VPCSubnetheaderspayloadSecurity groupEC2 instanceHost IDS/IPSagentInternet gatewayNetwork ACLInternet
Header filtering happens at the subnet and ENI. Payload and file inspection only happen on the host or an inline firewall.

IDS versus IPS

ItemWhat to remember
IDSWatches traffic and hosts, then reports to admins or a SIEM. Detects only.
IPSDetects and blocks or drops malicious packets automatically.
GuardDutyDetection only. It is not an IPS. You can bolt on response with EventBridge and Lambda.
Where it runsHost agent on EC2, inline appliance from AWS Marketplace, or AWS Network Firewall (Suricata-compatible IPS rules).
Management at scaleSystems Manager or Ansible installs and updates the agent on many instances.

Host-based controls

NeedControl
Application-level filteringOS firewall such as iptables or Windows Firewall. Network firewalls cannot see processes or users.
Deep packet inspectionHost agent or proxy-based DPI software. Security groups and NACLs cannot do it.
Detect modified filesHost-based IDS with file integrity monitoring. It compares current files to a trusted baseline and alerts.
Virtual appliance (NAT, proxy, IPS)Disable the source/destination check on its ENI so it can forward traffic that is not addressed to it.

The source/destination check is on by default. An ENI with it enabled only sends or receives traffic for its own IPs.

More host controls

  • A host firewall (iptables, nftables, Windows Defender Firewall) is a second layer, for example blocking IMDS for all users except root.
  • Third-party HIDS, antivirus and file integrity monitoring are deployed and kept running with State Manager associations or Distributor packages.
  • GuardDuty Runtime Monitoring gives process, file and network events on EC2, ECS and EKS (see GuardDuty).
  • The CloudWatch agent ships OS and application logs for detection.
  • EBS encryption by default, and Nitro Enclaves for processing highly sensitive data in isolation.

Gateway Load Balancer and third-party IDS/IPS

  • GWLB sends traffic transparently to a fleet of virtual appliances (Palo Alto, Fortinet, Check Point, open-source Suricata) using GENEVE on port 6081, keeping the original packet intact.
  • Consumers reach it through GWLB endpoints in their route tables, so the appliance fleet can live in a central security account.
  • Keep flows symmetric: enable appliance mode on the transit gateway VPC attachment for the inspection VPC.
  • Pick GWLB when the question names a vendor, requires a specific IPS signature feed, or reuses existing firewall licences. Otherwise Network Firewall is the lower-effort managed answer.
  • Traffic Mirroring copies ENI traffic to an out-of-band IDS for detection only. It can't block.

Protecting instance metadata

Instance metadata lives at 169.254.169.254 and includes the role credentials at iam/security-credentials/<role>. Anyone who can run code or make the instance fetch a URL can steal them.

IMDSv1IMDSv2
Plain request and responseSession token. A PUT request returns a token, then each GET carries it in a header
Open to SSRF through a simple URL fetchPUT is rejected when an X-Forwarded-For header is present, and the default response hop limit is 1, so proxies and containers are blocked
Allowed by default unless configuredSet the instance option to require tokens. Calls without a valid token get HTTP 401

Token lifetime runs from 1 second to 6 hours (21,600 seconds). Host firewall rules such as iptables can still restrict which local users reach the metadata address. Requiring IMDSv2 is the AWS-recommended control.

Exam signal

"Virtual appliance cannot forward traffic" means disable source/destination check. "Prevent SSRF from stealing instance role credentials" means require IMDSv2.

Exam trap

Security groups and NACLs cannot detect malware in a payload or a modified file. Pick a host-based IDS, a Network Firewall IPS rule group, or GuardDuty Malware Protection, not another SG rule.

Scenarios

Scenario
A bank must inspect all traffic between its 40 spoke VPCs and the internet with a specific vendor's next-generation firewall, because its SOC already uses that vendor's threat feeds and management console. The firewall fleet must scale out and survive the loss of an appliance. What design meets these requirements?

Further reading

On this page