/
Preparing NetMRI and Sandbox images

Preparing NetMRI and Sandbox images

This sections gives information about preparing the NetMRI and sandbox image for AWS deployment. You can obtain the NetMRI and sandbox images which will be in the form of gzip files by contacting support.


Each gzip files contains:

  • VMDK image files

  • SHA 256 of vmdk files

  • Examples of json files which will be used for further steps

Please download and unpack the gzip files to your local machine which has AWS CLI tools installed

Note
In code block commands started with the “$” symbol, everything that goes after a command is the command output.

Note
In the following example, We have created a folder named: NetMRI_AWS and extracted VMDK files into this directory. All the required json files are also moved to this directory.

$ mkdir ~/NetMRI_AWS $ cd ~/NetMRI_AWS $ pwd /home/user/NetMRI_AWS

All files are downloaded in the NetMRI_AWS folder as given below:

$ ls NetMRI* NetMRI-Sandbox.x86_64-AWS-7.6.0.tgz NetMRI-Sandbox.x86_64-AWS-7.6.0.tgz.sha256 NetMRI.x86_64-AWS-7.6.0.tgz NetMRI.x86_64-AWS-7.6.0.tgz.sha256

The shasum command can be used for verification as given in the example below:

$ shasum -c -a 256 NetMRI.x86_64-AWS-7.6.0.tgz.sha256 NetMRI.x86_64-AWS-7.6.0.tgz: OK $ shasum -c -a 256 NetMRI-Sandbox.x86_64-AWS-7.6.0.tgz.sha256 NetMRI-Sandbox.x86_64-AWS-7.6.0.tgz: OK

The compressed archive file NetMRI.x86_64-AWS-7.6.0.tgz contains the vmdk files to be uploaded to the AWS S3 bucket in the next step.

You can extract the files to the folder created at the home directory using the tar -xvf command as given below:

$ tar -xvf NetMRI.x86_64-AWS-7.6.0.tgz x NetMRI.x86_64-AWS-7.6.0.106865.vmdk x NetMRI.x86_64-AWS-7.6.0.106865.vmdk.sha256 x netmri-block-device-mapping.json x netmri-disk-container.json $ tar -xvf NetMRI-Sandbox.x86_64-AWS-7.6.0.tgz x NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk x NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk.sha256 x netmri-sandbox-block-device-mapping.json x netmri-sandbox-disk-container.json

Uploading VMDK images as AWS AMI

The following steps will help you in deploying VMDK image as an AWS AMI and will include command examples and their outputs.

It is assumed that you have fulfilled the prerequisites and are prepared to utilize the AWS CLI environment. For illustration purposes, we are utilizing the us-east-1 AWS region and operating the AWS CLI with the profile NetMRI-Dev-AWS. Please adjust these parameters to match your configuration.

The NetMRI_AWS directory will look like this after all files are unpacked

$ ls NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk.sha256 NetMRI-Sandbox.x86_64-AWS-7.6.0.tgz NetMRI-Sandbox.x86_64-AWS-7.6.0.tgz.sha256 NetMRI.x86_64-AWS-7.6.0.106865.vmdk NetMRI.x86_64-AWS-7.6.0.106865.vmdk.sha256 NetMRI.x86_64-AWS-7.6.0.tgz NetMRI.x86_64-AWS-7.6.0.tgz.sha256 netmri-block-device-mapping.json netmri-disk-container.json netmri-sandbox-block-device-mapping.json netmri-sandbox-disk-container.json

Step 1. Upload images into S3 bucket

For this step you will need to create a new S3 bucket or use an existing one. If you don’t have an S3 bucket, you can create it using the AWS console or CLI. Please refer to the AWS Documentation to create an S3 bucket.

We prefer to use separated bucket, Hence, we have created a new bucket with the name netmri-7.6.0 using the AWS cli tool as given below:

$ aws s3api create-bucket --bucket netmri-7.6.0 --acl private --region us-east-1 --profile NetMRI-Dev-AWS

Execute the following command to upload the NetMRI VMDK into the S3 bucket:

$ aws s3api put-object --bucket netmri-7.6.0 --key NetMRI.x86_64-AWS-7.6.0.106865.vmdk --body NetMRI.x86_64-AWS-7.6.0.106865.vmdk --region us-east-1 --profile NetMRI-Dev-AWS { "ETag": "\"2eecad91fafe8279a0b242eb6c2587fc\"", "ServerSideEncryption": "AES256" }

The command can be used without the --profile NetMRI-Dev-AWS flag which seems to give the correct output. This applies throughout the document.

You can repeat the same for the sandbox VMDK as given below:

$ aws s3api put-object --bucket netmri-7.6.0 --key NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk --body NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk --region us-east-1 --profile NetMRI-Dev-AWS { "ETag": "\"0cf4c4d748ac3ae019900b5d2bc8c28a\"", "ServerSideEncryption": "AES256" }

You can verify that the files are inside S3 bucket using the command given below:

$ aws s3 ls netmri-7.6.0 --region us-east-1 --profile NetMRI-Dev-AWS 2024-02-21 11:23:17 451981824 NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk 2024-02-21 11:23:53 3713834496 NetMRI.x86_64-AWS-7.6.0.106865.vmdk

Step 2. Create an EC2 snapshot from VMDK

In this step, you'll need to prepare two JSON files, each containing the necessary information for your bucket name and file name within the bucket. Examples of these JSON files are given below:

For NetMRI

{ "Description": "NetMRI 7.6.0 VM VMDK", "Format": "VMDK", "UserBucket": { "S3Bucket": "BUCKET_NAME", "S3Key": "FILE_NAME" } }

For Sandbox

{ "Description": "NetMRI Sandbox 7.6.0 VM VMDK", "Format": "VMDK", "UserBucket": { "S3Bucket": "BUCKET_NAME", "S3Key": "FILE_NAME" } }

BUCKET_NAME is the name of the bucket into which NetMRI and Sandbox VMDK files are uploaded.

FILE_NAME is the name of the VMDK file inside the bucket.

Additional details regarding the import-snapshot command, its parameters, and JSON format can be found in the AWS documentation.
We use the following naming convention for the JSON files:

  • For NetMRI: netmri-disk-container.json

  • For Sandbox: netmri-sandbox-disk-container.json

You can import the NetMRI VMDK as an EC2 snapshot by following the command below:

$ aws ec2 import-snapshot --description "NetMRI 7.6.0 VM" --disk-container "file:///home/user/NetMRI_AWS/netmri-disk-container.json" --region us-east-1 --profile NetMRI-Dev-AWS { "Description": "NetMRI 7.6.0 VM", "ImportTaskId": "import-snap-045b3d340c2465684", "SnapshotTaskDetail": { "Description": "NetMRI 7.6.0 VM", "DiskImageSize": 0.0, "Progress": "0", "Status": "active", "StatusMessage": "pending", "UserBucket": { "S3Bucket": "netmri-7.6.0", "S3Key": "NetMRI.x86_64-AWS-7.6.0.106865.vmdk" } }, Unset Unset "Tags": [] }

The current status of importing can be verified with the command given below:

aws ec2 describe-import-snapshot-tasks --import-task-ids IMPORT_SNAP_ID--region us-east-1 --profile NetMRI-Dev-AWS

IMPORT_SNAP_ID - is the value from the import-task-id field

Note
Importing tasks might take some time, so you should check the status periodically, when importing is finished the Status will be completed. Additional information about this command can be found in the AWS Documentation.

To check the current status of the NetMRI VMDK import, execute the following command:

$ aws ec2 describe-import-snapshot-tasks --import-task-ids import-snap-045b3d340c2465684 --region us-east-1 --profile NetMRI-Dev-AWS { "ImportSnapshotTasks": [ { "Description": "NetMRI 7.6.0 VM", "ImportTaskId": "import-snap-045b3d340c2465684", "SnapshotTaskDetail": { "Description": "NetMRI 7.6.0 VM", "DiskImageSize": 3713834496.0, "Format": "VMDK", "SnapshotId": "snap-0f080c03312dd0a00", "Status": "completed", "UserBucket": { "S3Bucket": "netmri-7.6.0", "S3Key": "NetMRI.x86_64-AWS-7.6.0.106865.vmdk" } }, "Tags": [] } ] }

You can repeat the same commands to import Sandbox VMDK as snapshot:

$ aws ec2 import-snapshot --description "NetMRI Sandbox 7.6.0 VM" --disk-container "file:///home/user/NetMRI_AWS/netmri-sandbox-disk-container.json" --region us-east-1 --profile NetMRI-Dev-AWS { "Description": "NetMRI Sandbox 7.6.0 VM", "ImportTaskId": "import-snap-0c917f6bbfb339222", "SnapshotTaskDetail": { "Description": "NetMRI Sandbox 7.6.0 VM", "DiskImageSize": 0.0, "Progress": "0", "Status": "active", "StatusMessage": "pending", "UserBucket": { "S3Bucket": "netmri-7.6.0", "S3Key": "NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk" } }, "Tags": [] }

Verifying current status of Sandbox VMDK importing:

$ aws ec2 describe-import-snapshot-tasks --import-task-ids import-snap-0c917f6bbfb339222 --region us-east-1 --profile NetMRI-Dev-AWS { "ImportSnapshotTasks": [ { "Description": "NetMRI Sandbox 7.6.0 VM", "ImportTaskId": "import-snap-0c917f6bbfb339222", "SnapshotTaskDetail": { "Description": "NetMRI Sandbox 7.6.0 VM", "DiskImageSize": 451981824.0, "Format": "VMDK", "SnapshotId": "snap-0779a19279cf34259", "Status": "completed", "UserBucket": { "S3Bucket": "netmri-7.6.0", "S3Key": "NetMRI-Sandbox.x86_64-AWS-7.6.0.106863.vmdk" } }, "Tags": [] } ] }

Once the import of both NetMRI and Sandbox snapshots is complete, we can proceed to the next step, which involves registering them as Amazon Machine Images (AMIs).

Step 3. Register an AMI from snapshot

Similar to the previous step, we need to prepare disk mapping json files for each Sandbox and NetMRI AMI. The examples for these files are given below:

For NetMRI:

[ { "DeviceName": "/dev/xvda", "Ebs": { "DeleteOnTermination": true, "Iops": 3000, "SnapshotId": "SNAPSHOT_ID", "VolumeType": "gp3", "Throughput": 150 } } ]

For Sandbox:

[ { "DeviceName": "/dev/xvda", "Ebs": { "DeleteOnTermination": true, "Iops": 3000, "SnapshotId": "SNAPSHOT_ID", "VolumeType": "gp3", "Throughput": 150 } } ]

SNAPSHOT_ID is the unique snapshot ID which can be found with the describe-import-snapshot-tasks command as the value of the SnapshotId key. Detailed instructions on utilizing this command are provided in Step 2 of the VMDK image uploading process

Additional information about the register-image command, its parameters and the json format can be found in the official AWS Documentation.

The json files are named as given below:

  • For NetMRI : netmri-block-device-mapping.json

  • For Sandbox : netmri-sandbox-block-device-mapping.json

Once the register-image command is executed as given below you will get a unique AMI Id.


You can register the NetMRI AMI as given below:

$ aws ec2 register-image --name "NetMRI 7.6.0 VM" --description "NetMRI 7.6.0 VM" --architecture x86_64 --ena-support --block-device-mappings "file:///home/user/NetMRI_AWS/netmri-block-device-mapping.json" --root-device-name "/dev/xvda" --virtualization-type hvm --boot-mode uefi-preferred --region us-east-1 --profile NetMRI-Dev-AWS { "ImageId": "ami-0dc73df3c11fed6a3" }

Similarly Sandbox AMI can be registered as given below:

$ aws ec2 register-image --name "NetMRI Sandbox 7.6.0 VM" --description "NetMRI Sandbox 7.6.0 VM" --architecture x86_64 --ena-support --block-device-mappings "file:///home/user/NetMRI_AWS/netmri-sandbox-block-device-mapping.json" --root-device-name "/dev/xvda" --virtualization-type hvm --boot-mode uefi-preferred --region us-east-1 --profile NetMRI-Dev-AWS { "ImageId": "ami-0b74aa8f49b34d9d0" }

Step 4. Clean up after AMI registered

After the AMI has been registered, you can safely remove the S3 bucket if it was created in Step 1 or only remove the VMDK files from the S3 bucket. Please refer the AWS Documentation for detailed instructions.


However, snapshots cannot be removed from AWS until we have at least one registered AMI associated with with them. Please refer the AWS Documentation for further information.

Deploying NetMRI and Sandbox images as EC2 instances

For launching new AWS instances please use the following documentation as a reference point. But keep in mind next points:

  • EC2 instance type and EBS storage type must be selected according to NetMRI AWS deployment best practices.

  • In case of OC + Col setup all traffic must be allowed between OC and its Collectors.

  • In case of NetMRI + Sandbox setup, SSH, HTTP, HTTPS traffic must be allowed between each NetMRI deployment (i.e. OC, Coll, SA member) and its sandbox.

  • SSH Key authentication doesn’t work in case of both NetMRI and Sandbox instances.

  • In case of Cloud-Init deployment, the same configuration file as per OpenStack deployment can be used.