Using iText DITO in AWS ECS

Prerequisites 

  1. An EC2-based ECS cluster up and running
  2. IAM ECS Task Role with a policy to allow MeterUsage

In addition to the typical Cloudwatch and ECR access (e.g. AmazonECSTaskExecutionRolePolicy) please make sure the role has a policy that allows AWS Marketplace Meter Usage

{

    "Version": "2012-10-17",

    "Statement": [

        {

            "Action": [

                "aws-marketplace:MeterUsage"

            ],

            "Effect": "Allow",

            "Resource": "*"

        }

    ]

}

DITO ECS Task Definition

Create a new ECS Task Definition with the following properties

 EC2 Compatibility

EC2 Compatibility


In container definitions, fill in the correct container image address  (e.g. 709825985650.dkr.ecr.us-east-1.amazonaws.com/itext-software/itext-dito-sdk:itext-dito-sdk-2.0.1.12).

Use the port mapping 49157 (host): 8080 (container). Create a new volume (local or EFS) and mount it under the container path /var/opt/dito.

Enable AWS CloudWatch logs to gain visibility over the container output.

Important Note: additional detailed logs are currently written locally under /var/log/dito. If you wish to access those you can mount an additional container volume in that location.

Container Definitions

Container Definitions 

Starting a DITO ECS Service

Create a new ECS service based on the newly created task definition. If everything is properly configured, a new ECS task will start and your DITO service will be up and running.

ECS Task Running 

ECS Task Running


Using the DITO HTTP API

In the ECS Task that is running, you will be able to fetch the external link information that gives you the ability to interact with the DITO service.

External Link in ECS Task

External Link in ECS Task