Compose Stack processing workflows

Updated about 1 month ago

This page shows how to compose and deploy processing Workflows on Koyeb Stacks. In this documentation, we create a new Stack with a processing Workflow which will:

  1. Resize all uploaded images and convert them to the JPG format.
  2. Perform object labeling using AWS Rekognition.
  3. Output the detected label into a JSON file.
  4. Draw the identified label bounding boxes with debug information from the source image.

There are five steps to deploy and compose a new Stack Workflow:

  1. Create a Service configuration to enable AWS service
  2. Create a new Stack
  3. Compose a Workflow
  4. Configure Workflow processing Steps
  5. Test the Workflow

Create a Service configuration to enable AWS service

Click the "CREATE" button in the navigation menu and select Service. The list of services supported by Koyeb appears. Click the AWS service. You land on the service page where you can create a new AWS service configuration.

Services AWS

Service configurations are used to securely store your access credentials for third-party providers. They allow you to re-use the same credentials across integrations without having to duplicate them.

Click the "ADD SERVICE CONFIGURATION" button to add a new configuration for the AWS service. A modal opens and ask for:

  • The service configuration name
  • An AWS access_key
  • An AWS secret_key

Services  AWS with add service configuration expanded

In this documentation, we use only the Rekognition API, so you can limit the AWS credentials to this service.

Create a new Stack

The Service configuration created, we can now create a new Stack. Click the "CREATE" button in the navbar and select Stack.

You land on the Stack creation page.

Give your Stack a name. The Stack name acts as the bucket name, you can't edit it, and it must comply with the DNS naming convention.

Compose a Workflow

In the Workflow list, select "Compose Workflow".

Stacks new with Workflow type menu expanded

Configure Workflow processing steps

The Source card represents the entry point of the Workflow. Let's add the first step of the Workflow, the resize step.

Resize step

Click the "+" button on the right side of the Source card.

Stacks new with empty custom Workflow

The list of available integration steps appear. Select Koyeb image resize integration on the list. The integration settings then appear. Configure the integration as below:

  • Format - The desired output format: JPEG
  • Width - The desired output width in pixel: 1050

!Stacks new with custom Workflow add step

Then click the save button. This step converts all images uploaded to the Stack in the JPEG format. We now need to add an Export step to write the result of the processing step to our Stack.

Click the export icon on the bottom right of the card and configure it as below:

  • Name - Must be unique: image-resize-export
  • Prefix - The prefix used to output the results: distribution/

Once done, click the Save button. To learn more about the Export integration, check out the complete documentation here

Image object detection step

The last step of the Workflow is to perform image object labeling on the images. Click the "+" button on the right side of the Source card.

In the integrations list, select the "Image object detection provided by Amazon Web Services"

As we previously configured the AWS service, we just have to set up the integration. Check the Drawboundingboxes checkbox. This option will output the image with bounding boxes for debugging additionally to the detected object JSON file. You can learn more about other settings by reading the integration details in the catalog.

The last step of our Workflow is to Export the result of the image detection to the Stack Store. Click the export icon on the bottom right of the image object detection card and with the following settings:

  • Name - Must be unique: image-label-detection-export
  • Prefix - The prefix used to output the results: analysis/

Once done, click the Save button. To learn more about the Export integration, check out the complete documentation here

If you followed the previous steps, your Workflows looks as below:

Stacks new basic Workflow AWS

Click the Create Stack button to deploy the Stack.

Test the Workflow

Once deployed, you land on the Stack page. Click the Explorer tab to perform an upload and see what happens when uploading an image.

Stacks page explorer

On the Explorer page, click the "UPLOAD" button. A modal opens and lets you drag and drop your files. Select a few images and launch the upload. If everything is fine, in a few seconds, you will see two folders:

  • distribution/: Containing the resized and converted images
  • analysis/: Containing for each image a JSON file of the detected objects and an image with the draw bounding boxes for each object identified.
footer-frame