Eureka Ansible Playbook and AMIs

View code on GitHub

Eureka is a service registry for resilient mid-tier load balancing and failover. Before running the playbook, there are a few things we need to do:


You need Ansible and AWS set up an configured. This is a 10 minute process, and you can watch Episode 2 to see how to do it.

Launch EC2 instance for Eureka

  1. Create a Eureka security group
    • Allow port 22 for SSH
    • Allow port 80 for HTTP
  2. If you don't already have one, create a new Key Pair, and add it to your keychain or SSH agent so you don't need to specify it later:

    $ ssh-add mykey.pem
  3. Launch a new EC2 instance using the above Security Group and key pair. This time, we will use Amazon Linux.

  4. Set the Name tag of the instance to Eureka
  5. Confirm you can see the instance using the Ansible EC2 inventory
    $ /etc/ansible/hosts | grep 'Eureka'

Run Ansible playbook

Now you can run the playbook

$ ansible-playbook playbooks/eureka-amazon-linux.yml -l 'tag_Name_Eureka'

This will configure the instance to be running the latest snapshot build of Eureka. If you prefer to build your own WAR file yourself, just specify the path to the WAR file:

$ ansible-playbook playbooks/eureka-amazon-linux.yml -l 'tag_Name_Eureka' -e "local_war=/path/to/eureka-server.war"

Access Eureka

Once the playbook is finished, you will have Eureka Server running inside Tomcat on your EC2 instance. You can access it via HTTP. Example:


You can find the list of pre-built AMIs here:


This playbook does nothing for security. It is highly recommended that you put some kind of restrictions on who can access Eureka.


If you have feedback, comments or suggestions, please feel free to contact Peter at Answers for AWS, create an Issue, or submit a pull request.

View code on GitHub