Manual:CHR AWS installation: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
No edit summary
 
(30 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Tools required ==
== Launching CHR on Amazon Web Services (AWS) ==
There are several steps that are necessary to lauch a CHR instance on AWS. By default only SSH (command line) access and only using SSH keys is allowed to Amazon instances.
 
=== SSH Keys on Windows ===
To generate SSH key on Windows [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTYgen] tool is needed.
* Generate SSH key pair, use the two buttons to save both the private ("Save private key") and the public ("Save public key") part to your computer (two files).
[[File:CHR_SSH_01.png]]
* Upload the '''public''' part to the '[https://console.aws.amazon.com/ec2/v2/home AWS EC2 Dasboard]' -> Key Pairs
[[File:CHR_SSH_02.png]]
* Launch the CHR instance from '[https://aws.amazon.com/marketplace AWS Marketplace]'
[[File:CHR_SSH_03.png]]
* Select the SSH key
[[File:CHR_SSH_04.png]]
* The IP address of your CHR instance is available in EC2 Management Console -> Running Instances screen
* Connect to the CHR instance using [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]
* Select the '''private''' key (PuTTY: Connection -> SSH -> Auth section)
[[File:CHR_SSH_05.png]]
* Enter the IP address
[[File:CHR_SSH_06.png]]
* Default username is 'admin'
[[File:CHR_SSH_07.png]]
 
=== SSH Keys on Linux/macOS ===
If you're using Linux or macOS, you can generate SSH keys either on your computer using 'ssh-keygen' command or using Amazon generated key and connect from the terminal using following command:
ssh -i private.key admin@1.2.3.4
where 1.2.3.4 is the IP of your CHR instance on AWS. The private.key file permissions have to be set so that only the owner has access to it. Use command
chmod 600 private.key
to alter the permission. See previous section how to upload your SSH keys to AWS.
 
''For more info see [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_Network_and_Security.html Amazon EC2 User Guide -> Network and Security section]''
 
== Creating your own CHR image ==
{{Warning|Following instructions are necessary ONLY if you want to make your own CHR image. Ready to use CHR image is available from Amazon Marketplace (see above)}}
 
=== Tools required ===
To get CHR RouterOS running on Amazon AWS cloud at this moment, there are certain steps that you have to do to get this working from scratch.
To get CHR RouterOS running on Amazon AWS cloud at this moment, there are certain steps that you have to do to get this working from scratch.


Line 6: Line 40:
* AWS API tools installed and configured (ec2-*).
* AWS API tools installed and configured (ec2-*).


== Installation steps (long)==
=== Installation steps (long version)===
 
* Resize the image before installing the RouterOS. Amazon AWS minimal image size is 1GB. After RouterOS is installed it will be much harder to change the available size, the following command will increase the image size to 940MB
qemu-img resize chr-6.34rc21.img +870M


* Resize the image before installing the RouterOS. Amazon AWS minimal image size is 1GB. After RouterOS is installed it will be much harder to change the available size, the following command will increase the image size by 940MB
  qemu-img resize chr-6.34rc21.img +940M
* Import the image as a volume on your AWS. As a return you will get the volume ID
* Import the image as a volume on your AWS. As a return you will get the volume ID
  ec2-import-volume chr-6.34rc21.img -f raw -s 1 -b <bucket> -o <AKIAEXAMPLELALALA> -w <SECRETACCESSKEY > -z eu-west-1a
ec2-import-volume chr-6.34rc21.img -f raw -s 1 -b <bucket> -o <AKIAEXAMPLELALALA> -w <SECRETACCESSKEY > -z eu-west-1a
 
''The import may take a while, it is possible to follow the progress'':
ec2-describe-conversion-task <task id>


It is possible to follow the progress of the import.
* Create a snapshot. Correct volume ID will be availabe when the previous command ends or from your AWS account
  ec2-cancel-conversion-task <task id>
ec2-create-snapshot vol-e3c74810


* Create snapshot. Correct volume ID will be availabe when previous command ends or from your AWS account
* Register AWS image as an AMI
  ec2-create-snapshot vol-e3c74810
ec2-register -n CHR -s snap-a664a48e -d "6.34rc21" -a x86_64 --virtualization-type hvm


* Register AWS image as an AMI ec2-register -n CHR -s snap-a664a48e -d "6.34rc21" -a x86_64 --virtualization-type hvm
* Now you can launch the instance from your AMI.
  ec2-register -n CHR -s snap-a664a48e -d "6.34rc21" -a x86_64 --virtualization-type hvm


* Now you can launch instance from your AMI.


== Alternative installation ==
{{Note|Since 6.35rc42 extra step of installation on itself is not required}}


* On your AWS EC2 switch over to Ireland cluster and look up AMI ID '''''ami-fce6448f'''''
== See also ==
* copy it over to cluster of your choice
http://wiki.mikrotik.com/wiki/Manual:CHR
* Launch instances

Latest revision as of 10:54, 5 August 2016

Launching CHR on Amazon Web Services (AWS)

There are several steps that are necessary to lauch a CHR instance on AWS. By default only SSH (command line) access and only using SSH keys is allowed to Amazon instances.

SSH Keys on Windows

To generate SSH key on Windows PuTTYgen tool is needed.

  • Generate SSH key pair, use the two buttons to save both the private ("Save private key") and the public ("Save public key") part to your computer (two files).

  • Select the SSH key

  • The IP address of your CHR instance is available in EC2 Management Console -> Running Instances screen
  • Connect to the CHR instance using PuTTY
  • Select the private key (PuTTY: Connection -> SSH -> Auth section)

  • Enter the IP address

  • Default username is 'admin'

SSH Keys on Linux/macOS

If you're using Linux or macOS, you can generate SSH keys either on your computer using 'ssh-keygen' command or using Amazon generated key and connect from the terminal using following command:

ssh -i private.key admin@1.2.3.4

where 1.2.3.4 is the IP of your CHR instance on AWS. The private.key file permissions have to be set so that only the owner has access to it. Use command

chmod 600 private.key

to alter the permission. See previous section how to upload your SSH keys to AWS.

For more info see Amazon EC2 User Guide -> Network and Security section

Creating your own CHR image

Warning: Following instructions are necessary ONLY if you want to make your own CHR image. Ready to use CHR image is available from Amazon Marketplace (see above)


Tools required

To get CHR RouterOS running on Amazon AWS cloud at this moment, there are certain steps that you have to do to get this working from scratch.

  • Virtual management software that works with ISOLINUX booter/installer on CHR image (KVM, VirtualBox or VMWare Workstation, VMWare Fusion, Hyper-V these tools are interchangeable);
  • Tool to resize the image file prior the installation as default image is 64MB of size and in some cases, more storage is required (qemu-img, VMWare built-in tool, VirtualBox external tool);
  • AWS API tools installed and configured (ec2-*).

Installation steps (long version)

  • Resize the image before installing the RouterOS. Amazon AWS minimal image size is 1GB. After RouterOS is installed it will be much harder to change the available size, the following command will increase the image size to 940MB
qemu-img resize chr-6.34rc21.img +870M
  • Import the image as a volume on your AWS. As a return you will get the volume ID
ec2-import-volume chr-6.34rc21.img -f raw -s 1 -b <bucket> -o <AKIAEXAMPLELALALA> -w <SECRETACCESSKEY > -z eu-west-1a

The import may take a while, it is possible to follow the progress:

ec2-describe-conversion-task <task id>
  • Create a snapshot. Correct volume ID will be availabe when the previous command ends or from your AWS account
ec2-create-snapshot vol-e3c74810
  • Register AWS image as an AMI
ec2-register -n CHR -s snap-a664a48e -d "6.34rc21" -a x86_64 --virtualization-type hvm
  • Now you can launch the instance from your AMI.


Note: Since 6.35rc42 extra step of installation on itself is not required


See also

http://wiki.mikrotik.com/wiki/Manual:CHR