Category Archives: AWS

RabbitMQ Clustering on AWS using Ansible

In this short post, I’ll show you the steps to configure the RabbitMQ clustering on AWS using Ansible. We decided to use the RabbtiMQ instead of AWS SQS because we want better performance and also require some flexibility.

In this setup, we have created 3 EC2 servers(Ubuntu 14.04 LTS) and 1 classic ELB on AWS. Clients both providers and consumers connect to the RabbitMQ servers through ELB, so system will be functional even one or more server will be down in other words system will be operational as long as one of the server is running.

RabbitMQ Requirement(Copied from official RabbitMQ Site):

RabbitMQ nodes address each other using domain names, either short or fully-qualified (FQDNs). Therefore hostnames of all cluster members must be resolvable from all cluster nodes, as well as machines on which command line tools such as rabbitmqctl might be used.

Hostname resolution can use any of the standard OS-provided methods:
DNS records
Local host files (e.g. /etc/hosts)

Settings on AWS: Read more of this post

Advertisements

Jenkins Installation and GitHub OAuth Integration using Ansible

In this tutorial, we’ll use Ansible to automate the installation of Jenkins CI on a fresh Ubuntu 14.04 LTS and integrate it with the GitHub OAuth. Ansible will also assign the matrix based permission on the Jenkins like which github user or group(s) have what rights on the Jenkins. Beside that, it will also install the Apache which serves as frontend for all the Jenkins requests.

In short, in this tutorial we’ll do the following tasks using Ansible:

  • Install the JAVA 7
  • Install the mentioned version of Jenkins(in this case it will be 1.658)
  • Install the desired plugins
  • Install the Apache and configure it as frontend for Jenkins
  • Install the SSL certificate for Apache Virtual Host that act as frontend for Jenkins
  • Integrate the Jenkins with GitHub using OAuth for Authenication
  • Configure the matrix based security using the github username or group

Read more of this post

Autoscaling with AWS instances using Ansible-Pull

Ansible has an excellent feature called ansible-pull, which many people don’t know or don’t use. This feature works best for self healing infrastructure, best example is AWS Autoscaling in which new ec2 instance is created from vanilla ami, then pull the code from somewhere (version control system) and configure itself before announcing that it is ready to serve (mean add to the serving ELB).

The steps for ansible-pull are:

1. Pull the git repo containing your playbooks.
2. That repo is cloned to the mentioned directory.
3. ansible-pull starts executing the local.yml found in your cloned repo directory.

Let’s assume that you want to pull the code from the private git repo and for this you need the ssh private key but you have taken the updated vanilla ubuntu ami from the Marketplace, then how you will clone this private repo? For this we’ll use the Bootstrap Pattern:

– Put the private part of ssh key for the git repository on S3.
– Getting ssh key from s3 bucket using IAM role credentials

For this, create a S3 bucket(in my case it is named “tendo-github-key-s3“):

s3-1

Read more of this post

Create AWS Cloudfront Distribution using Terraform

In this post, we’ll create the AWS Cloudfront Distribution using Terraform and for this, we need the latest version of Terraform.

Terraform v0.6.15
  • Complete Cloudfront Terraform Plan as gist
  • Complete Variables as gist

Before using the terraform, we need to export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as environment variables:

export AWS_ACCESS_KEY_ID="xxxxxxxxxxxxxxxx"
export AWS_SECRET_ACCESS_KEY="yyyyyyyyyyyyyyyyyyyy"

Read more of this post

%d bloggers like this: