This repository is the result of a course I took related to Networking in Public Clouds. The course details are available at the following link.
https://www.ipspace.net/PubCloud/
Each directory contains a separate project from the course. As we progress through the course, we built on top of the previous project. The directory list below shows the chronological order the projects were assigned.
- requirements
- IaC
- network
- webServer
- networkv6
- security
All of infrastructure deployments were fully automated using Terraform and Ansible
- Compute options should meet diverse memory and cpu requirements
- Compute options should serve elastic demands of the business
- Different storage tiers should be available as per business needs.
- Traffic between existing data center and cloud should be encrypted
- Roles based access should be available for different business units
- Cloud offering should incorporate Infrastructure as code principles.
- Resource usage cost should be available in near real time.
- Traffic into and out of cloud should be controlled
- Cloud should provide DHCP and DNS services
- Cloud should offer different segments with the ability to isolate from each other.
- Hosts in the cloud should have connectivity to data center as well as Internet (local breakout)
- Cloud should offer stateful firewall services
- Cloud should offer audit-trail of the activities performed.
- Cloud should offer presence in different geographical areas.
There are various tools available to deploy infrastructure in public clouds. I started off with Ansible since I am most familiar with it. But soon I realized that, when using Ansible I need to take care of dependencies and order of execution. I started reading about Terraform and felt that this might be a better tool. Since it is free to use, I downloaded and gave it a try. It is well documented and easy to use. I think going forward I will continue to use it.
- Create an AWS VPC and add one public subnet and one private subnet
- Create a route table for public subnet and add an Internet Gateway to it.
- Create a route table for private subnet and add a NAT Gateway to it.
- Create different security groups, detail will be later in the document.
- Deploy a jumphost in public subnet and ssh access is allowed from admin host only.
- Deploy a web server in public subnet and allow tcp/80 from anywhere.
- Deploy a backend server (aka private server) that can only talk to web server.
- jumphost is allowed to talk (tcp/22) to both web server and backend server.
- An Ubuntu VM is deployed in AWS cloud using Terraform.
- AWS Security Groups are created using Terraform.
- These Security Groups limit incoming traffic to http and ssh
- All outbound traffic is allowed
- "images" and "files" directories are uploaded to S3 buckets using Terraform
- images directory contains all the images used in the website
- files directory backs up all apache related config files.
- A record is created in AWS Route53 for the website.
- After VM is ready, Ansible is used to install and configure Apache webserver.
- Enable IPv6 in VPC
- Enable IPv6 in Public and Private Subnet
- In the Public Subnet Route Table, create a default route for IPv6.
- Add IPv6 cidr blocks in the security groups.
- Deploy a dual stacked jumphost in public subnet and ssh access is allowed from admin host only.
- Deploy a dual stacked web server in public subnet and allow tcp/80 from anywhere.
- Deploy a dual backend server (aka private server) that can only talk to web server.
- jumphost is allowed to talk (tcp/22) to both web server and backend server.
- Public/Web server access is restricted to HTTP protocol from anywhere.
- jumphost is accessible only on tcp/22 from administrator's host.
- Private servers is not directly accessible from outside world.
- SSH access to public and private servers is available through jumphost only
- All of above restrictions are achieved through AWS security groups.
- An IAM Policy is created that allows read-only access to EC2 and VPC.
- An IAM Policy is created that allows full access to one S3 bucket specific to this project. All other S3 access requests are denied
- Create a IAM role that allows to send logs to AWS Cloudwatch Logs.
- Attach this role to jumphost and send all auth logs to Cloudwatch.
- An Ansible playbook installs awslogs package on jumphost and also configures it.
- Finally enable VPC Flow Logs to track IP flows.