How to deploy open source network ids/ips in AWS

Setting up an EC2 instance as a VPC security gateway can monitor and protect your cloud assets. The EC2 security gateway routes IP traffic between the VPC and the Internet and therefore has complete visibility of the full-duplex traffic to and from your protected instances. The Network IDS running on the EC2 gateway instance will then allow you to identify and shut down threats as if it was deployed in a physical network. network IDS in a security gateway

Setup Instructions

  1. Launch a VPC and give it a network range (ex. 
  2. Create a private subnet (ex. and a public subnet (ex. 
  3. Set up the NAT gateway: 
    • Launch the EC2 security gateway instance on the public subnet.
    • Assign an EIP address to the instance. This will be your externally routable address. 
    • Make sure to modify the network adapter to DISABLE src/dst Checking
    • Configure this instance as a normal NAT device for the private subnet: 
      • echo 1 > /proc/sys/net/ipv4/ip_forward 
      • iptables -t nat -A POSTROUTING -s -j MASQUERADE 
  4. Add additional IP addresses on the public subnet (if needed):
    • EC2 will automatically assign a public subnet address to your instance once it is launched. Each instance can have additional IP addresses on the public subnet assigned to it in step 2
    • For each of these IP addresses you can assign an EIP. Limits may apply depending on the type of instance you choose. 
  5. Set up the routing tables: 
    • The public subnet should have a default route for to an amazon IGW device
    • The private subnet should have a default route for to the instance id of the MetaFlows EC2 instance 
  6. Launch the EC2 instances to be monitored in the private subnet 
  7. Add port forwarding rules to iptables for publicly accessible services. You can follow these instructions to do that