Embarking on the AWS App Runner Journey

Lilupa Karu
6 min readJan 22, 2024

In our nature, there’s an inherent inclination to choose the easiest route — a tendency that might be a gift from the universe. The universe, it appears, operates on a core principle: accomplishing tasks with the least amount of energy.

Translating this philosophy into the realm of modern cloud computing reveals a shared endeavor among industry leaders. Their goal is to provide innovative cloud services that simplify and intelligently streamline your tasks. When I initially explored AWS App Runner, the resonance of the analogy above became evident.

Let’s take a dive into App Runner features

Its a list of features provided by AWS App Runner

In the winter of 2021 (where I live in the southern hemisphere 🙂), AWS introduced App Runner, a shiny new addition to its family. Imagine it as your trusty guide in the realm of crafting and unleashing containerized web applications — all with a magical touch of simplicity, requiring less of your sweat and toil.

What makes App Runner a game-changer?

A fully-managed container-native service that holds your hand through the maze of building and deploying your web application. Forget the hassle of orchestration configuration, the fuss of setting up build pipelines, the headaches of optimizing load balancers, and the chore of rotating TLS certificates. And yes, you heard it right — no servers to babysit.

But that’s not all. Picture a world where your billing is counted by the second, ensuring you only pay for what you use.

Now, here’s the showstopper: with just a few clicks, you can summon a container into existence, complete with a public endpoint, a verified TLS certificate, and the nifty ability to scale automatically. It’s like having your own digital genie, ready to grant your scaling wishes.

App Runner general architecture

Let’s look at the distinctive advantages of App Runner and explore the first steps to dive in by crafting a service.

Embarking on this demo adventure, I’m crafting a REST API service, unveiling it securely to the world, linking it with a user-friendly React web app, and presenting a visualization for users. So, what’s the star of our web app show? Most important drink in the world… water? nah… coffee. We will display a charming list of coffees on our web app, through a service hosted in App Runner. For a glimpse of the magic, check out the architecture diagram.

This image describes the architectural components of our demo apps

Let’s climb up the ladder step by step.

Create the REST API app

I harnessed the power of NestJS to craft a basic REST API service. Now, let’s dive into the world of AWS App Runner. Instead of intricately fashioning a masterpiece with NestJS, I choose simplicity. This simple app fetches data from a JSON file and unveils it through a RESTful service.

There are two techniques to build the App Runner service from the source code: either create a container image from ECR or build the container directly from the source code in a GitHub repository. I opted for the latter technique, so I pushed my code to a GitHub repository.

Allow AWS to access GitHub

AWS App Runner facilitates GitHub access through Connected Accounts, enabling you to establish a connection between App Runner and my GitHub repository. I’ll later use the Connection ARN to configure my App Runner service.

App Runner configuration file

When I set up an AWS App Runner service using my source code repository, AWS App Runner needs details on how to build and launch my service. I can input this information each time I create the service through the App Runner console. On the flip side, I have the option to configure service settings using a handy configuration file.

In my “apprunner.yaml” file, I’ve laid out the specifics for my API service — setting up the runtime, build configuration, and run configuration. If you’re curious about the details, the App Runner configuration file reference in the AWS documentation is where you’ll discover more.

Build App Runner Service

AWS allows the App Runner console to build a service from scratch, however, I took a strategic approach, leveraging the power of CDK for enhanced reusability and streamlined deployment.

Within my CDK project, I crafted a dedicated stack tailored for App Runner. I incorporated the App Runner construct library by installing and seamlessly integrating it into the stack. It’s worth noting that, during the creation of this demo, there wasn’t an officially finalized L2 construct library for the App Runner module. Two options available at that time are listed below.

  1. Use the L1 construct library and define all the required attributes
  2. Use the experimental L2 construct library with caution.

I took on the challenge of delving into the experimental construct library, but I highly recommend diving into the AWS CDK documentation and exploring the latest content on Construct Hub before embarking on your App Runner and CDK adventure.

App Runner Stack

In my setup, I outlined the service and configured the source to establish a connection with GitHub, utilizing the previously specified GitHub connection ARN.

Once the CDK project is ready, synthesize it using cdk synth and then deploy using cdk deploy.

How it looks on App Runner?

When I set up the App Runner stack, it grabs the most up-to-date source code from the specified repository and branch. It then goes on to configure the App Runner services according to the provided settings — covering everything from the build and runtime specifications to CPU, memory, health checks, autoscaling, deployment, and more. Finally, it rolls out the containerized app and crafts a secure URL for access.

Everything is set to roll now. I’ve got a fully operational RESTful API service neatly tucked into a containerized application within AWS App Runner.

Client web app

For my next move, I’d love to dive into the API and present the fascinating realm of coffees through a visually appealing user interface. Leveraging React, I crafted a straightforward web application to showcase a delightful array of the most popular coffee varieties sourced from the App Runner hosted service.

This web application utilizes Axios to fetch data from the APIs and employs React Bootstrap to enhance the page’s visual appeal. Here are the results.

After a client uses it, you can explore the metrics to discover requests, active instances, CPU usage, and more. Additionally, you can dive into your App Runner service configuration, examining aspects like source and build configuration, virtual CPU and memory settings, auto scaling, health checks, security, network settings, and observability.

In my view, considering everything, I’d say that adding App Runner to your toolkit is a smart move if you’re aiming to boost development speed and expand your market presence. This tool brings significant value and can make a real difference in how swiftly and effectively you can achieve your goals.

I constantly remind myself of this principle. Embracing containers doesn’t involve immersing in complexities; instead, it’s about utilizing simplicity to efficiently, securely, and reliably deliver software.

Infrastructure CDK code: https://github.com/karu-lk/coffee-run-cdk

NestJS API service: https://github.com/karu-lk/coffee-run

React front-end: https://github.com/karu-lk/coffee-run-web

--

--

Lilupa Karu

Experienced Solutions Architect | 16+ years crafting innovative Cloud/Serverless solutions | Ardent proponent of AWS | Cloud Evangelist