This repository contains terraform code to deploy a sample AWS Hub and Spoke architecture with an Inspection VPC using AWS Network Firewall. The resources deployed and the architectural pattern they follow is purely for demonstration/testing purposes.
- An AWS account with an IAM user with the appropriate permissions
- Terraform installed
- Writing DRY (Do No Repeat Yourself) code using a modular design pattern
- Clone the repository
- Edit the variables.tf file in the project root directory. This file contains the information used to configure the Terraform code.
Note EC2 instances, and AWS Network Firewall endpoints will be deployed in all the Availability Zones configured for each VPC. Keep this in mind when testing this environment from a cost perspective - for production environments, we recommend the use of at least 2 AZs for high-availability.
terraform init
to initialize the environment.terraform plan
to check the resources to createterraform apply
to build the architecture.
terraform destroy
will clean-up the resources created.
The AWS Network Firewall Policy is defined in the policy.tf file in the network_firewall module directory. By default:
- All the SSH and RDP traffic is blocked by the Stateless engine.
- The Stateful engine follows Strict Rule Ordering, blocking all the traffic by default. Two rule groups allow ICMP traffic (between East/West traffic only), and HTTPS traffic to any *.amazon.com domain.
This project configures both the alert and flow logs to respective AWS Cloudwatch Log Groups (both for the VPC Flow logs and AWS Network Firewall logs). In VPC Flow logs, you can also use Amazon S3. In Network Firewall, you can also use Amazon S3, or Amazon Kinesis Firehose.
To follow best practices, all the logs are encrypted at rest using AWS KMS. The KMS key (alongside the IAM roles needed) is created using the iam_kms module.
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.
Name | Version |
---|---|
terraform | >= 1.3.0 |
aws | >= 3.73.0 |
Name | Version |
---|---|
aws | >= 3.73.0 |
Name | Source | Version |
---|---|---|
compute | ./modules/compute | n/a |
hubspoke | aws-ia/network-hubandspoke/aws | 3.2.0 |
iam_kms | ./modules/iam_kms | n/a |
spoke_vpcs | aws-ia/vpc/aws | = 4.4.2 |
Name | Type |
---|---|
aws_networkfirewall_firewall_policy.anfw_policy | resource |
aws_networkfirewall_rule_group.allow_domains | resource |
aws_networkfirewall_rule_group.allow_icmp | resource |
aws_networkfirewall_rule_group.allow_tcp | resource |
aws_networkfirewall_rule_group.drop_remote | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_region | AWS Region. | string |
"eu-west-1" |
no |
identifier | Name of the project. | string |
"hubspoke-inspection" |
no |
inspection_vpc | Inspection VPC definition. | any |
{ |
no |
spoke_vpcs | Spoke VPCs definition. | any |
{ |
no |
Name | Description |
---|---|
instances | EC2 instances created. |
network_firewall | AWS Network Firewall ID. |
transit_gateway_id | AWS Transit Gateway ID. |
transit_gateway_route_tables | Transit Gateway Route Table. |
vpcs | VPCs created. |