Datalogics PDF Utility API

Datalogics PDF Utility API AMI Setup Guide, EC2

Setting up your Amazon Machine Image (AMI) in the AWS Marketplace

With our Datalogics PDF Utility API on AWS we provide an Amazon Machine Image, or AMI. An AMI is a snapshot of a server configuration that is installed on the Amazon Marketplace.  You can use our AMI as a template to build a server instance, and thus add our PDF processing features to your own AWS environment. With this feature you can build and save your own custom workflows and run them as often as you like. The AMI is an image of a server device; AWS creates a server configuration for you, and then it runs on Amazon server hardware.

  1. To set up the AMI in the AWS Marketplace, start by logging on to the AWS Management Console at aws.amazon.com.
  2. Select EC2 from the All services section of the AWS services panel.
  3. Find and click the Launch Instance button and then click Launch Instance. This will take you into the launch wizard. The Choose Amazon Machine Image (AMI) Screen appears. Click the AWS Marketplace tab.

Sign on

If you don’t see Datalogics under Featured Software or Popular Software here, or under Quick Start, you can search for the Datalogics PDF Utility API instead.

  1. Click the Select button to launch the AMI.
  2. Choose an Instance Type, and click Sign on. The Review Screen (Step 7) appears.

Sign on

  1. From the Review Screen click Sign on.

Sign on

AWS Marketplace provides you with a .pem file, which holds a public key that you can use to securely log on to your AMI server.  You only need to download the .pem file once.

  1. Click the down arrow, and select "Create a new key pair:"

Sign on

  1. Enter a name for your new Key pair (.pem file) and click Sign on. Save the file for use later.
  2. Then, click button.

Sign on

  1. Click button to see the AMI instances currently running.

Sign on

  1. At this point you have completed the process to start your AMI instance in the AWS Marketplace. Now you need to log on to your server so that you can complete the configuration, using an ssh command.

The Username for the instance is "centos."  Access the instance using the Mac Terminal or a Windows or Linux command line interface:

ssh -i yourpemfile.pem centos@publicdnsnamehere

The command statement might look like this:

ssh -i "qa.pem" centos@ed2-3-82-152-###.compute-1.amazonaws.com

This is where you enter the name of the .pem file that you downloaded.

AWS also provides your publicdns. The Domain Name System (DNS) assigns a default IP address to your AMI device.

Note: When implementing a scaling solution, use DNS of the Load Balancer instead of the DNS of the EC2 instance.

To access the publicdns value, find the Instance ID value on the AMI Instances screen shown above:

Sign on

Click on the ID. The Instance Summary appears.

Look for Public IPv4 DNS on the Details tab.

Sign on

AWS builds your AMI server image and stores it in this directory:

/opt/datalogics/pdf-utility/config/

  1. Look in this folder for a file called settings.js.
          const settings = {
            removeOriginalProcessed: {
              active: true,
              delay: 600000
            },
            maxProcessTime: 60, // max process lifetime in seconds
            inputKey: 1,
            outputKey: 0,
            redirectRoot: "https://datalogics.com",
            serverDomain: "YOUR_DOMAIN_HERE"
         };
         module.exports = settings

You need to edit the settings.js file to provide your own server domain in the serverDomain field. Use the Public DNS found in step 11.

  1. Save the settings.js file and then restart your instance, pm2, to apply your changes.

 pm2 reload 0

  1. Check the status of PM2:

 pm2 status

You should see that your instance, Datalogics-PDF-Utility-API, is online.

If you don't, please contact us using this form:

https://www.datalogics.com/datalogics-cloud-feedback/

You will find logs for PM2 at:

/home/centos/.pm2/logs/Datalogics-PDF-Utility-Api-out.log

Changing the maximum time provided for processing requests

You may increase or decrease the time provided to process each request by changing the Maximum Process Time (maxProcessTime) setting in your settings.js file (defaults to 60 seconds). If the process does not finish successfully in the time allowed by this setting, the process ends.

  1. Make sure that you turn off the node server.  This is important any time you update your configuration settings:

 pm2 stop 0

  1. Check the status to confirm that the server has stopped.

 pm2 status

  1. Update the settings.js JSON file in the /config directory.  Change the maxProcessTime setting to the time you want, in seconds.  If you wanted to increase the time to 30 minutes, enter 1800, for 1800 seconds.
  2. Save the file and close it.
  3. From the config directory, run:

 sudo node apply_settings.js

  1. Restart the node server:

 pm2 reload 0