Manual upgrade for MarkLogic AWS AMI
11 July 2018 02:05 PM
If you have an existing MarkLogic Server cluster running on EC2, there may be circumstances where you need to upgrade the existing AMI with the latest MarkLogic rpm available. You can also add a custom OS configuration.
This article assumes that you have started your cluster using the CloudFormation templates with Managed Cluster feature provided by MarkLogic.
1. Launch a new small MarkLogic instance from the AWS MarketPlace, based on the latest available image. For example, t2.small based on MarkLogic Developer 9 (BYOL). The instance should be launched only with the root OS EBS volume.
b. Choose instance type. For example, one of the smallest available, t2.small
2. SSH into your new instance and switch the user to root in order to execute the commands in the following steps.
$ sudo su -
Note: As an option, you can also use "sudo ..." for each individual command.
3. Stop MarkLogic and uninstall MarkLogic rpm:
$ service MarkLogic stop
4. Update-patch the OS:
$ yum -y update
Note: If needed, restart the instance (For example: after a kernel upgrade/core-libraries).
5. Install the new MarkLogic rpm
$ yum install [<path_to_MarkLogic_RPM>]/[MarkLogic_RPM]
Note: Do not start MarkLogic at any point of AMI's preparation.
6. Double check to be sure that the following files and log traces do not exist. If they do, they must be deleted.
$ rm -f /var/local/mlcmd.conf
7. Remove artifacts
$ rm -f /root/.ssh/authorized_keys
8. Optional - Create an AMI from the stopped instance. The AMI can be created at the end of step 7.
$ init 0
 For more information: https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/tkv-create-ami-from-instance.html
At this point, your custom AMI should be ready and it can be used for your deployments. If you are using multiple AWS regions, you will have to copy the AMI as needed.