Milos Bejda - All Things Automated

Setting Up a CoreOS Cluster on AWS EC2 (with pictures)

This is going to be a quick to the point guide on getting a 3 instance CoreOS cluster running in Amazon Web Services.

Prerequisites

You must have an AWS account.
You must have the AWS-Cli installed.

Note:

Make sure your AWS-CLI version is AWS-CLI 1.7.23 or better.
In a MAC you can check the AWS-CLI version by typing the following :

aws --version

I do not recommend installing AWS-CLI through MAC HomeBrew because it is outdated, instead I recommend installing the latest AWS-CLI through PIP.

##Security Group
First we are going to create a security group for our instances. For simplicity, we are going to make this security group open to the world. Even though security is important, this tutorial serves an educational purposes and you should never have all ports open in production.

Navigate to the AWS security group

Click on create new security group.
You can name the security group whatever you want. I named my security group 'open'. You also have to add a description and for learning sake create an inbound rule that is open to all traffic on all ports and set the source to anywhere. Then click create.

##Our First AWS CoreOS Cluster
We have our security group and our cloud config. I assume by now your AWS-CLI configured with your AWS account. If its not, checkout this guide to help you out.
[http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html "target="_blank).
###Lets Get Our CoreOS Image ID.
As of writing this article, the latest CoreOS version 668.2.0. Make sure to find an Amazon Image ID that is as close to the latest version as possible. Other versions may potentially have problems. The image-id I'm using is ami-6b44725b.

###You Need a KeyPair
If you don't have a key-pair setup with your AWS account take a look at this guide here [http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html "target="_blank).

For education purposes, the key name that I'm using is called 'MyKeyPair'.

###Launching The Cluster
Execute the following AWS-CLI command in the terminal to launch your cluster :

Replace the parameter values to your values and execute the command in your terminal. The terminal should output a long JSON with instance data. When you look into your AWS EC2 dashboard you should notice 3 micro CoreOS instances launched.

Congratulations. You have your CoreOS cluster. Just to make sure everything is working, get the IP of your instance and ssh into that instance. By default CoreOS uses 'core' as the root user. So in your terminal you would execute the following

ssh -i MyKeyPair.pem core@some-public-ip

and in the machine run

fleetctl list-machines

If you want to check if that particular instance is a leader execute the following :