DEV Community

Cover image for Deploy a scalable app from scratch in minutes with AWS App Runner
Daniel Bayerlein for AWS Community Builders

Posted on

Deploy a scalable app from scratch in minutes with AWS App Runner

Have you heard of AWS App Runner? A few weeks ago, AWS announced a new service called AWS App Runner - the original blog post can be found here. AWS App Runner is a fully managed container application service that let you build, deploy and run containerized web applications and APIs in minutes. I'll show you how to do that in this blog post.

Supported AWS Regions

Currently, AWS App Runner is supported in the following regions: US East (N. Virginia), US East (Ohio), US West (Oregon), Europe (Ireland), and Asia Pacific (Tokyo).

Benefits

App Runner resources and infrastructure components are fully managed by AWS, which means you don't have to worry about scaling or infrastructure security or even be an expert in it. Resources are scaled automatically based on traffic. You stay completely focused on your application.

Pricing

  • You are charged for the compute and memory resources used by your application.
  • If you automate your deployments you will pay a set monthly fee for each application that covers all automated deployments for that month.
  • If you opt to deploy from source code, you will pay a build fee for the amount of time it takes App Runner to build a container from your source code.

More information can be found on the AWS App Runner Pricing page.

AWS Console

Of course, you can also deploy the service using AWS CDK. But first, let's take a look at the AWS Console to learn about the service. Because with just a few clicks, your app is ready to go.

Source and deployment

The first step is to choose a source for the App Runner service and how it should be deployed.

Source

You can choose between an AWS Container Registry (Amazon ECR or Amazon ECR Public) and a Git repository provided by GitHub.

AWS App Runner console - source section

If you choose the Container Registry option, then you only need the Container image URI. If you want to use your Git repository on GitHub, you need to install the AWS Connector for GitHub app.

Deployment

Next, you need to choose whether the deployment should be automatic or manual.

AWS App Runner console - source deployment

Automatic deployment is not available with every source option. If you use Amazon ECR, App Runner monitors your registry and deploys a new version of your service with each image push. If you use your Git repository from GitHub, then each push to the selected branch deploys a new version of your service.

Configure build

This step is only available if you have chosen "Source code repository".

AWS App Runner console - build section

Currently you can choose between Python 3 and Node.js 12 runtime. The "Build command" specify the command that will be used to install the dependencies or compile the code. If you use the configuration file, you can additionally specify pre and post commands! The "Start command" specify the command to start a web server for your service. Also specify the port to be used by the service.

The configuration can be done manually or provided via a configuration file (apprunner.yaml).

version: 1.0
runtime: nodejs12 
build:
  commands:
    pre-build:
      - npm install
    build:
      - npm run build
    post-build:
      - npm test
run: 
  command: npm start
  network:
    port: 3000
Enter fullscreen mode Exit fullscreen mode

📚 App Runner configuration file reference

Configure service

In this step the service is configured by assigning the resources.

Service settings

AWS App Runner console - service section

Name the service and configure the number of CPUs, as well as the required memory.

Auto scaling

You can use the default auto-scaling settings or configure this manually.

AWS App Runner console - auto scaling section

If you configure it manually, you can set the following parameters: Concurrency, Minimum size (instances) and Maximum size (instances).

Health check

App Runner performs a TCP health check at the port that your application is listening to.

AWS App Runner console - health check section

You can set the parameters Timeout, Interval, Unhealthy threshold and Health threshold.

Security

AWS App Runner console - security section

In the Security section you can select an IAM role for the instance and specify whether to use an AWS-owned key or a custom AWS KMS key.

Tags

AWS App Runner console - Tags section

Use tags to search and filter your resources, track your AWS costs and control access permissions.

Deployment time 🚀

In the last step you can review your configuration and then start the creation process! After a short time you will find the URL of your app in the AWS App Runner Console.

AWS App Runner console

In addition to service metrics, event, deployment and application logs are also available in the AWS App Runner Console.

I don't think you can deploy a scalable application any easier or faster. 🚀


If you have any kind of feedback, suggestions or ideas - feel free to comment this post!

Top comments (2)

Collapse
 
aditmodi profile image
Adit Modi

Hi Daniel,
great explanation on app runner service.
I myself tried it , are you aware about apex ( root ) custom domain mapping from route53 / any other service to app runner.
I tried to map my custom domain to app runner. any suggestions ?

Collapse
 
danielbayerlein profile image
Daniel Bayerlein

Hi Adit, maybe the documentation will help you: Managing custom domain names for an App Runner service.