Publish Your API Builder Docker Image to the AMPLIFY Runtime Services (ARS)



Deploy an API Builder application to AMPLIFY Runtime Services

In a prior blog post, we described how API Builder Standalone can easily be used to create microservices and package them as a Docker Image that can be run in any Docker infrastructure.

This blog post will describe how to run that docker image in Axway’s AMPLIFY Runtime Services (ARS), an elastically scalable infrastructure that runs your API Builder applications. It follows the Deploy an API Builder Standalone application to AMPLIFY Runtime Services How To.

Create your API Builder Project

If you don’t already have a working API Builder Standalone project, then follow the Getting Started Guide to create one.

As before, I created a simple API Builder Project, apibm, that uses MongoDB Atlas as the backend. Instructions for installing the MongoDB connector can be found here.

My MongoDB connector configuration (mongo.default.js), is shown below:

module.exports = {
    connectors: {
        mongo: {
            connector: '@axway/api-builder-plugin-dc-mongo',
            url: 'mongodb+srv://{username}:{password}{database name}?retryWrites=true',
            generateModelsFromSchema: true,
            modelAutogen: true


NOTE: Replace the MongoDB url above with the appropriate url for your database.

Modify Your Default Config File

Modify the conf/default.js file so that the port takes process.env.PORT instead of 8080 as follows:

port: process.env.PORT || 8080,


Note that this is requirement for ARS

Test Your API Builder Project

Test your project by running locally using ‘npm start’ and then test your API using curl or Postman.

I tested my dog collection using curl as follows:

curl https://localhost:8080/api/mongo/dog


with the following result:

  "success": true,
  "request-id": "a57263db-3221-4153-9e45-19a573e1af96",
  "key": "dogs",
  "dogs": [
      "id": "5a24a9a67779e860d007b13e",
      "breed": "Poodle",
      "name": "Fido"
      "id": "5b3aafcb9de9003840480fe7",
      "breed": "Doberman",
      "name": "Doobie"


Create your Docker image

Follow the instructions in the Dockerize an API Builder Service Guide to create your docker image.

As described in the guide above, make sure your image is created and make sure you can run your
docker image locally.

For my API Builder project, I used the following commands to build and test my docker image:

docker build -t apibm ./
docker run --rm --name apibm -p 80:8080 apibm


Note that I’m mapping port 80 on my host to port 8080 in the container since that is the default port that API Builder is listening on.

I tested my dog collection using curl as follows:

curl https://localhost/api/mongo/dog


with the same result as above. Now that our docker image is created and tested, we can proceed to publish it to ARS.

Publish Your API Builder Docker Image to ARS

Refer to the ARS Command Line Interface Reference to publish your docker image.

Recall that my project and docker image name is apibm so the command to publish this image is:

acs publish apibm --delete_oldest --force --image apibm --app_version 0.1


You should see something similar to below:

You should also get an email with the status of your deployment (success or failure) as shown below:

You should check your project from the command line using:

acs list apibm
acs logcat apibm


Note that it can take some time (up to 10 minutes) for your project to be deployed and your APIs to be accessible. If your API is not responding and you use ‘acs logcat’ and get a ‘port 80 in use’ error, try setting the PORT to 8080 using:

acs config --set PORT=8080

Test Your Published API

The email you receive as well as the printout from ‘acs list apibm’ will provide the base URL for your API. For example, see below printout from ‘acs list apibm’ for my project:

I can test my API via curl using the following command:



I got the same result as before, so my project is deployed and working properly.

Monitor Your Microservice

You can head over to, select your API Builder project and view information about your microservice as shown in the screen shots below:

Increase Server Size

By default, your server size is set to ‘Dev’. When there is no activity for an hour, your container will automatically be put to sleep and reactivated when a new request comes in. In order to keep your server alive, you can set the server size using the following command:

acs server --set Small


Sizes are Dev, Small, Medium, ‘Large’, ‘XLarge’. Sizes are described here.


In this blog post, we saw how to leverage Axway ARS to publish our API Builder Microservice as a docker image.