Skip to content

5. Install MiaRec software on EC2 instance

We will deploy MiaRec to Amazon EC2 instances using Ansible provisioning tool.

You need to follow the step-by-step instructions "Installation on Linux using Ansible" with a few additions described below.

You can run Ansible playbook from:

  • Any Linux host with Internet access (Ubuntu, Centos, Redhat). Mac OS X should work as well, but not tested by us.
  • Windows 10 with Linux subsystem
  • Another EC2 instance.

Copy SSH private key to Ansible Controller machine

You need to use previously created key to access the instance via SSH. Check Connecting to Your Linux Instance Using SSH for details.

Copy the private key to the Ansible Controller machine, for example, to ~/.ssh/aws-key.pem.

Use the chmod command to make sure that your private key file isn't publicly viewable:

chmod 400 ~/.ssh/aws-key.pem

Test SSH connection to EC2 instance:

ssh -i ~/.ssh/aws-miarec.pem ubuntu@

If everything is ok, you should see the following message the first time you connect to it:

The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:uTU/hyG+7qy1Aq0CxliKekYDWXZI0EEAaPkmXuA9K9M.
Are you sure you want to continue connecting (yes/no)?

Enter yes. You should connect to the instance now and see Ubuntu welcome message like:

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-125-generic x86_64)

* Documentation:

System information as of Fri Sep 22 01:32:04 UTC 2017

System load:  0.0                Processes:           103
Usage of /:   0.6% of 125.86GB   Users logged in:     0
Memory usage: 2%                 IP address for eth0:
Swap usage:   0%

Create Inventory file (/opt/ansible-miarec/hosts)

In the step [3. Configure deployment] of instructions, you will need to create hosts file. If you selected Ubuntu as OS for EC2 instance, then create the following file:

miarec1 ansible_ssh_host= ansible_ssh_private_key_file=~/.ssh/aws-key.pem ansible_port=22 ansible_user=ubuntu
miarec2 ansible_ssh_host= ansible_ssh_private_key_file=~/.ssh/aws-key.pem ansible_port=22 ansible_user=ubuntu



  • Two hosts are defined inside group miarec. Ansible playbook will be executed against all hosts in group. By default, installation will be done simultaneously.
  • Replace and with public ip-addresses of your EC2 instances (these should point to Elastic IP addresses created previously).
  • The parameter ansible_ssh_private_key specifies the location of SSH private key for connecting to EC2 instance (in our example, it is ~/.ssh/aws-key.pem).
  • The parameter ansible_user is set to ubuntu for Ubuntu system. For Centos, you need to set it to root.

Now, test Ansible connection to AWS using the command:

 ansible miarec -m shell -a "uname -a" 

This command will connect to all hosts in group miarec in inventory file and print the output of command uname -a.

You should see something like:

miarec1 | SUCCESS | rc=0 >>
Linux ip-10-0-1-65 3.13.0-125-generic #174-Ubuntu SMP Mon Jul 10 18:51:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

miarec2 | SUCCESS | rc=0 >>
Linux ip-10-0-2-73 3.13.0-125-generic #174-Ubuntu SMP Mon Jul 10 18:51:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Deploy MiaRec to EC2 instances

Follow instructions to deploy MiaRec on EC2 instances using Ansible.

Verify MiaRec web portal and create admin account

Navigate in web browser to the Elastic IP address of each of MiaRec instances, like

When you access MiaRec web portal the first time, it will ask you to create admin account. You need to create unique accounts for these two servers, like "admin" and "admin2". This is necessary to prevent conflicts during synchronization between servers.

Create Admin Account