Via G. Falcone 5, Pollenza (MC), Italy
+39 0733 203595

Infrastructure scripts

In the previous article we described the reasons that made us change the provider. 

In this article we will describe how we built our infrastructure as code.

As a first step let’s create a bash script to run the playbook:

With the flexibility of AWS & Ansible we can easily craft an isolated multi environment:

Then we need a playbook for each infrastructure’s component :

Now let’s dig into some details for each playbook.

VPC (Virtual Private Cloud) 

This is the playbook for VPC creation and network routing:

All instances in an env have a private network class. We also set up a gateway to connect our vpc with the internet.

It only remains to create a routing rule:

Good. We now have a fully functional vpc, one for each environment.

EC2 (Elastic Compute Cloud)

With the following playbook we build some EC2 instances to host our applications:

ELB (Elastic Load Balancer)

Having VPC and EC2 instances in place, we need a load balancer to distribute load on our backends. It’s pretty easy with AWS:

In the next article we’ll show you another chapter of our migration to AWS.

Stay tuned!

Related Posts

2 comments

How do you deploy the application code to EC2? Is it already baked in EC2 Image?

Loreno Edelmondo

These scripts are for the infrastructure. We do deploy with other scripts. In practice, we download the code from github and configure the environment. Maybe we will do an article on deploy.

Leave a reply