Community discussions

MikroTik App
 
User avatar
merlinthemagic7
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 52
Joined: Fri Sep 16, 2016 8:49 pm

While we wait for a stable AWS CHR for t3 instances

Mon Apr 01, 2024 1:15 pm

If you build your own AMI on AWS there are no issues upgrading / downgrading the CHR.

The current documentation (https://help.mikrotik.com/docs/display/ ... HR+7.6+AMI) assumes you know how to create trust policies and roles on AWS. I think that can be quite intimidating for some users.

Below is a step by step including the JSON files required to spin up a CHR with a custom AMI that does not suffer from the current issues on T3 instances.

-------
Download the json files attached to this post (awsFiles.zip).

Create a new S3 bucket. The one i used is called "chr-tester", given that bucket name is now taken replace "chr-tester" with your bucket name, e.g. "my-chr-bucket-55" in these 2 file (from the zip archive attached to the post):
mikrotik-routeros-chr-7142-raw-containers.json
role-policy.json
Next Download the raw image (if you download a newer version, you will need to change the files. Beter to just upgrade after the initial install):
https://cdn.mikrotik.com/routeros/7.14.2/chr-7.14.2.img.zip
Unzip and upload the .img file to the bucket.
chr-7.14.2.img
Next open a cloud shell. You access EC2, click the cloud shell icon top right.
Then upload the 4 files from the zip archive by clicking "Actions-> Upload File" in the cloudshell window. Dont change the file, e.g. version is not your version but an amazon thing, just upload:
mikrotik-routeros-chr-7142-raw-containers.json
aws-import-snapshot-mikrotik-chr-7142.sh
trust-policy.json
role-policy.json
Run as command in the cloud shell:
aws iam create-role --role-name vmimport --assume-role-policy-document file:///home/cloudshell-user/trust-policy.json
Run as command in the cloud shell:
aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document file:///home/cloudshell-user/role-policy.json
Run as command in the cloud shell:
bash /home/cloudshell-user/aws-import-snapshot-mikrotik-chr-7142.sh import-snapshot
Grab the line with "ImportTaskId: from the import job, e.g:
"ImportTaskId": "import-snap-65467756756765"
Monitor the job, replace "import-snap-65467756756765" with your job ID:
bash /home/cloudshell-user/aws-import-snapshot-mikrotik-chr-7142.sh monitor-import import-snap-65467756756765
Wait for the job to finish. When it happens you will see:
"StatusMessage": "snapshot completed"
Then Ctrl + C to exit

Grab the line with "SnapshotId: from the monitor job, e.g:
"SnapshotId": "snap-54654756878568"
Run as command in the cloud shell, replace "snap-54654756878568" with your job ID:
bash /home/cloudshell-user/aws-import-snapshot-mikrotik-chr-7142.sh register-image snap-54654756878568
Grab the line with the AMI image ID e.g.:
"ImageId": "ami-36547567578657"
Finally you can start launching instances with your own AMI. Just go to "EC2->images->amis".
Find your image and launch, then configure as normal and voila, you have a CHR instance that can be upgraded / downgraded without bricking.
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 1 guest