logo
Steps
1
Overview
2
Set up directory structure
3
Create a networking module
4
Network module output
5
Create main script and variables
6
Create stack configurations
7
Running the scripts
8
Conclusion

Overview

AWS is a very big and complex platform. Creating a SAAS on AWS can be a daunting task, especially if you are not familiar with AWS. There are so many configurations about VPC, subnets, security groups, etc to be created before you even begin provisioning your application/database servers. The UI and documentation can be very confusing.
So I prefer a script/code-based approach to creating infrastructure. 
Terraform is a popular choice to create your AWS infrastructure programmatically. This how-to guide helps you create a basic networking stack using terraform that you can use to create your SAAS. 

What you will create?

If you are starting a new SAAS project and planning to run your infrastructure on AWS, then you are going to need 
  • A VPC
  • 1 public/private subnet per availability zone
  • Networking set up like a public internet gateway and a private NAT gateway
  • Security group to control ingress/egress traffic 
The overall setup will look like below - 
Our basic networking stack setup

What you will need?

  • AWS Account with programmatic access 
  • Terraform (>0.12) installed on your operating system and binary is included in your system's PATH. 
If you are using mac, you can get terraform using homebrew easily. 
bash
Let's start !

Source Code

The entire source code is available here 
Next
Discussion
You
0