Sometimes, we need to make developments, customizations, and more in our local VMs and later on, we realize that the same developments would be great to have in the cloud as well. Therefore, this documentation will demonstrate how we can do such a task by using Bahmni Vagrant and AWS as cloud provider via its VM Import/Export feature.

Warning:

1. Using this feature will cost you money on AWS, therefore please make sure to check and terminate any resources that you don’t need anymore once you finish testing.

2. Cloud based systems are public, and hence at risk. Please ensure you setup firewalls, fail2ban, security groups/ACLs, private subnet, etc to keep your machine safe. Read more in the Bahmni Security Guide.

STEP 1: Exporting the VMs Image

Initially, we need to install Bahmni Vagrant for setting up Bahmni on our machine. For a detailed process on how to set it up, please follow this guide.

Once the Vagrant has been installed and Bahmni is up and running, you need to stop the VM in the Oracle VM VirtualBox Manager and export the VM as shown below:

Now we have an OVA file which is basically the image that can be used for exporting to the AWS.

note

note: You can execute the same task with your VMs that are running on a VMware® vSphere as well. What you need to know is that these VMs must be exported in one of the supported versions. For a list of supported versions, please follow this link.

note: You can execute the same task with your VMs that are running on a VMware® vSphere as well. What you need to know is that these VMs must be exported in one of the supported versions. For a list of supported versions, please follow this link.

STEP 2: Exporting it to AWS

As you will see in this documentation of the VM Import/Export, we need to have AWS Command Line Interface installed on our machine so that we can interact easier with AWS. For instructions on how to install it, please follow this link.

now execute

aws iam create-role --role-name vmimport --assume-role-policy-document "file://trust-policy.json"

now execute

aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document "file://role-policy.json"

note

note: Ensure that the name of the S3 bucket must be the bucket you've created on AWS. If you cannot create the bucket or execute any command, please refer to the documentation above because most probably you have some permission settings that are different, or the AWS CLI isn't installed properly.

note: Ensure that the name of the S3 bucket must be the bucket you've created on AWS. If you cannot create the bucket or execute any command, please refer to the documentation above because most probably you have some permission settings that are different, or the AWS CLI isn't installed properly.

aws s3 cp .\<path to your file\Bahmni-93-asha-cli.ova s3://<name of the s3 bucket>

now execute

aws ec2 import-image --description "<name of the AMI we want to have>" --disk-containers "file://containers.json"