Setting up your instance
For this process, you will need to have already launched an instance using the steps in Launching an instance.
Image showing where the user can see the existing EC2 Instances.

You can view information about your instance in the EC2 Console Instances view. You can reach it from the EC2 Dashboard with any of these links.

Image showing the location of the Instance ID link.

Checking the box will select the instance in this view, and clicking the link will open the instance details in its own view. For this guide, we’ll click the link and open the instance details in its own view.

Image showing the EC2's Public IPv4 DNS address.

Look for Public IPv4 DNS on the Details tab. Log onto the server using this DNS address, the username ec2-user, and the keypair you selected when creating the instance.

The following command will start the server with the default settings:
docker run -d -p 80:3000 --restart always pdf_toolkit_self-hosted_api:2.1.0

(If the Docker daemon is not running, run sudo systemctl start docker before starting the server.)

Run docker ps to view the running container and get its randomly generated name.

docker stop <container_name> will stop the server.

docker rm <container_name> will remove the container.

To configure your server, you can add optional variables to the docker run command with the -e flag. Use any of the following:

  • PDFREST_SERVER_DOMAIN: The service URL. Responses from the server will use this to generate a URL that output can be fetched with.
  • REDIRECT_ROOT_URL: Navigating to the service URL without specifying an endpoint will redirect to this URL.
  • REMOVE_ORIGINAL_PROCESSED: Enable or disable a lifecycle policy for files processed. Use 1 for enabled or 0 for disabled. Will delete files after time specified in "Document Lifecycle Policy Delay". A lifecycle policy is recommended.
  • REMOVE_ORIGINAL_PROCESSED_DELAY: Amount of time in milliseconds until a file is removed by the lifecycle policy.
  • MAX_PROCESS_TIME: The timeout in seconds before a file processing job is terminated.
  • MAX_UPLOAD_SIZE: Max file upload size in MB.

To view server logs, run docker container logs <container_name>.