Tuesday, January 31, 2017

Infrastructre as a code for Nodejs, Ubuntu and Nginx

Hello All:

Hosting a web application on a cloud platform (like AWS, Azure etc) requires lots of housekeeping task involving server provisioning, installing software etc.

Infrastructure as a code is a paradigm in which the necessary infrastructure is brought up with the help of code.

 In this post, I will introduce Terraform, a toolkit to write code infrastructure.

In short, Terraform helps in:
  1. Bringing up infrastructure using code
  2. Maintaining changes to the infrastructure 
  3. Maintaining dependency graphs of resources
Bringing an AWS server up  is as simple as executing a simple script.

Terraform scripts are written in .tf files.

I have created Terraform scripts to bring up Ubuntu server with following software installed on AWS
  1. Nginx
  2. Nodejs
  3. PM2
These scripts bring up Ubuntu server with all the necessary software needed to host a nodejs application.

In order to change the instance type, update this file.
Complete instructions and code is available here.

Thanks for printing this post. Hope you liked it.
Keep visiting and sharing.


Post a Comment