Showing posts with label continuous deployment. Show all posts
Showing posts with label continuous deployment. Show all posts

Wednesday, July 8, 2015

Deploying Custom Amazon Images with the AWS CLI on Demand

Hey All! Today I am going to go over how to make a gold image of an Amazon EC2 instance, then deploy copies of that instance on demand with a simple AWS CLI script! 

First of all, this tutorial assumes you have already installed the AWS CLI tools on your client architecture. You will also want to create a new IAM user such that you aren't using your root credentials to hit the AWS API, and make sure this new user has enough permissions to create new instances. Make sure to use that user's Access Key ID and Secret Access Key in your AWS CLI config. Finally, we will want to have launched default AMI, configured this system like we want every subsequent system (this includes setting up the AWS access keys, security group, and subnet) , and then turn this into a custom AMI using the Web Console:


Next, we are going to launch a copy of that instance using the following AWS command line script:

ec2-run-instances ami-xxxxxxxx -t t2.medium -k my-key-xxxxx -s subnet-xxxxxxxx -g sg-xxxxxxxx --associate-public-ip-address true

And boom! This will return all the details of the new instance it has just launched in the console, making it easy to script this simple command and parse the output to chain even more automated deployment (like then ssh-ing to the server and running some updated configuration scripts)!

Monday, June 8, 2015

How to continuously integrate, test and deploy

This post will walk through the steps of setting up a continuous integration server starting with a codebase from Github, automated by StackStorm.

Step 1: Deploy stackstorm on a server, following this guide.
  • There are many ways to install/deploy stackstorm, I'll be using vagrant.
  • I'm using my Windows based work computer to act as the server for this example, so vagrant is a great choice for getting things up and running.
  • First things first, clone the project, cd to the vagrant folder within, and "vagrant up" to get started!
And we're off!

Whoops, looks like vagrant was updated since I cloned the project! Let's fix that...
Great success! It's installed!

This will install all StackStorm components along with the Mistral workflow engine on Ubuntu 14.04 virtual machine. The setup will download additional packages from the internet. While waiting, check out StackStorm 101 Video for quick intro. If setup is successful, you will see the following console output.

Step 2: Create a sensor to integrate with repository commits.

Step 3: Create a rule to merge all branches into the master branch.

Step 4: Create a rule to run all test cases, and if successful, deploy to production server.