Giter VIP home page Giter VIP logo

aws-network-firewall-terraform's Introduction

AWS Network Firewall - Terraform Sample

This repository contains terraform code to deploy a sample architecture to try AWS Network Firewall. The resources deployed and the architectural pattern they follow is purely for demonstration/testing purposes. If you are looking for a set of approved architectures, read this blog post.

The image below is a graphical representation of what resources are defined in the Terraform code in this repository: Architectural Diagram with Two Spoke VPCs, Transit Gateway and Inspection VPC

The templates deploy three VPCs (spoke-a, spoke-b, and inspection). AWS Network Firewall endpoints are deployed in the Inspection VPC. Internet egress is also configured in the inspection VPC, by deploying NAT Gateways in Public Subnets.

The template deploys two EC2 instances in spoke-vpc-a and spoke-vpc-b for testing purposes. It also deploys resources so that connecting to these instances is enabled via AWS Systems Manager Session Manager.

The templates also deploy a webservice implemented by three EC2 instances web-host[1-3] in the spoke-a VPC, fronted by a private NLB. Ingress is centralised in the inspection VPC by the use of a public ALB with an associated Target Group with the private IPs of the private NLB as targets.

AWS Network Firewall Configuration

The firewall.tf template file contains the definitions of the FW rule-groups that these templates come with by default.

The default action taken by the stateless engine is Forward to stateful rule groups.

Alert logs are persisted in a dedicated Cloudwatch Log Group (/aws/network-firewall/alert).

Flow logs are persisted in a dedicated S3 Bucket (network-firewall-flow-bucket-*).

The rule-groups configured in the policy are the following:

  • drop-icmp: this is a stateless rule group that drops all ICMP traffic
  • drop-non-http-between-vpcs: this stateful rules drops anything but HTTP traffic between spoke VPCs.
  • block-domains: this stateful rule prevents any HTTP traffic to occur to two FQDNs specified in the rule itself.

The template deploys two instances in spoke-vpc-a and spoke-vpc-b in the protected subnets that you can use to test east-west connectivity (and north-south).

By default, the templates deploy in the eu-west-1 AWS Region. If you wish to deploy in any other AWS Region, edit the corresponding setting in the provider.tf file.

How-to

  1. Install Terraform (0.14.6 or higher)
  2. Clone this repository
  3. Initialise Terraform terraform init
  4. Deploy the template with terraform apply.

Tests

  • try a ping between instances in spoke-vpc-a and spoke-vpc-b: this shouldn't work
  • try to SSH to the EC2 Instance in spoke-vpc-b from the EC2 Instance in spoke-vpc-a (or vice-versa): this shouldn't work
  • try to curl the private IP of the EC2 Instance in spoke-vpc-b from the EC2 Instance in spoke-vpc-a (or vice-versa): this should work
  • try a ping to a public IP address: this shouldn't work
  • try to dig using a public DNS resolver: this shouldn't work
  • try to curl https://facebook.com or https://twitter.com: this shouldn't work
  • try to curl any other public URL: this should work
  • from any browser naviate to http://<public_alb_dns_name> where <public_alb_dns_name> is the DNS name of the ALB created by your Terraform code in the Inspection VPC.

Cleanup

Remember to clean up after your work is complete. You can do that by doing terraform destroy.

Note that this command will delete all the resources previously created by Terraform.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-network-firewall-terraform's People

Contributors

nicoaws avatar mkol5222 avatar ddericco avatar amazon-auto avatar heathsnow avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.