AWS App Runner - an example of deployment from the source code for the HapiJS app

By Daniel Aniszkiewicz ยท 23 May, 2021


In the previous blog post, we've explored briefly the AWS App Runner service, which was recently released. In this blog post, we will focus on deploying the HapiJS application (from the source code located on Github) to App Runner. Hopefully, AWS App Runner provides Node.js managed runtime, so there is no need to provide a container image for it.

The repository for the application could be found here. It's a very basic application, which has only one endpoint, that will tells us the day of the week, for the provided date parameter. (Example for the parameter '`date=23 May 2017`, it will return '`{"date":"23 May 2017","day":"This date was on Tuesday"}`).

The goals of this post are:

  • Make a successful deployment to the AWS App Runner from Github, based on the supported managed NodeJS runtime.

General content

Let's start working with the AWS App Runner service. Within the AWS App Runner website, click on Create an App Runner service. You will be redirected to the create service page. In the beginning, we have the Source and deployment section.


As we will deploy our application from the source code repository (located on Github), we will check the proper checkbox for it. For making possibility to make deployment, the AWS Connector for GitHub will be installed within your GH account (or organization).


There will be a couple of popups from Github that need to be click through, mostly due to allowing permission by AWS Connector to your repository/repositories.



After you will be connected to Github, simply choose the allowed repository and its branch.


Important. Please pay attention to the fact, that the service was released a couple of days ago, so some information is still missing (like hints information for steps are currently unavailable).

The next section is regarding the deployment settings. Two possibilities here:

  • manual deployment trigger, so each and every deployment will need to be processed via Ap Runner console or AWS CLI.
  • automatic, so each and every push to your setup branch will deploy a new version of the application.


Let's proceed with the Automatic option and hit next.

Now the build settings will pop up. Two options here. Either we can configure all settings in this step (runtime and port), or we can create a separate apprunner.yaml file within the application.

For the second option use the runtime keyword in an App Runner configuration file that you include in your code repository. More information about Node runtime release information could be found here.

This time we will set up all settings here.

  • choose Runtime Nodejs 12.
  • for build command simply npm install.
  • for start command node.
  • port 8000.

In the next step, we have possibility to configure the service, you can choose the name service, virtual CPU, and memory, and also add your env variables.


Underneath, you can setup:

  • auto scaling.
  • health check.
  • security.
  • tags.




We will use all default values for now. In the end, we can review our service and run a deployment process.

Waiting for the deployment, you can the overview of the service. Current status, service ARN, default domain (it will be underneath domain), as well as a GH source of the repository.


Moreover, you can check:

  • the activity of the service.
  • logs (download them, or view in CloudWatch).
  • configuration (all settings which you choose in previous steps).
  • service metrics.
  • custom domains (add your own domain - you can add up to 5 custom domains).

After the deployment will be finished, simply test it by:


  • We've learned how to seamlessly deploy HapiJS application to the AWS App Runner.

Next time, we will work on container image, to deploy Rails App to AWS App Runner.