DEV Community

Cover image for Deploy containerized services on AWS App Runner
Mubbashir Mustafa
Mubbashir Mustafa

Posted on • Edited on

Deploy containerized services on AWS App Runner

AWS App Runner is the easiest way to deploy your Containerized, Node or Python based services. You don't have to worry about managing infrastructure or scaling up and down the resources when the load increases or decreases.


ℹ️ Note: It's assumed that you are familiar with AWS ECR and your image has already been containerized and pushed. If you are new to AWS ECR then read this first.


To deploy your services on AWS App Runner, navigate to AWS App Runner from the AWS console

AWS App Runner from AWS Console

From there click on "Create an App Runner service"
Create an AWS App Runner service

Now you need to provide the source image - which AWS App Runner will deploy as a service. For this, select "Container Registry", "Amazon ECR" (select Public, if your image is not private) and paste the Container image URI (you can get it from AWS ECR)
Create an App Runner service from AWS ECR

Next configure the deployment settings for your service. Select "Automatic" (it will deploy a new version of your service as soon as the new image has been pushed), "Create new service role" and "Next"
AWS App Runner configure settings

Give any name to your backend service, select vCPU and memory as per the need (expected load/traffic), and enter environment variables (if needed) as key/value pairs

Backend services on AWS App Runner

In the "Auto-scaling" settings, you can use the default one or if you need to adjust them then create a "Custom configuration"

AWS App Runner auto-scaling options

  • Concurrency:
    Max. number of concurrent requests/connections after which a new instance will be launched

  • Minimum size:
    It's the minimum number of instances that will always be running regardless of load

  • Maximum Size:
    Maximum number of instances you want AWS App runner to launch when the load increases (in this case more than 100 concurrent requests/connections)

The health check is a mechanism to know whether the service is performing and stable or not. You can leave the default settings or configure them as needed

AWS App Runner Health Checks

By default, the Unhealthy threshold is set to 5. This essentially means that whenever 5 health check requests from the load balancer to an instance fails, it will consider it unhealthy and try to replace it.

Next, you can create a custom IAM role from the https://aws.amazon.com/iam/ that will give permissions to your container to communicate with other AWS services or you can leave it. To encrypt the stored image (if you chose ECR image ) or stored source code bundle (if you chose GitHub, earlier) you can use AWS-owned encryption key or customer-managed key CMK (can be created from https://aws.amazon.com/kms/.

By default, if you don't provide one, an AWS-owned encryption key is used.

AWS App Runner with AWS KMS

Tags are optional key/value pairs to help you identify and group your AWS resources. Add tags if needed and then click "Next"
AWS App Runner Tags

Review your configurations and click "Create & Deploy"
Create and Deploy AWS App Runner

It will take some time to build your app, once the status changes from "Operation in progress" to "Completed", your changes are deployed

Once the service has deployed successfully, get the default domain link and see it in action

AWS App Runner with automatic builds

Let's make some changes to your code and push it (build the docker image and push to AWS ECR - you will notice that the build process triggers automatically and deploys the new version

CI/CD in AWS App Runner

Notes:
AWS App Runner offers the easiest and quickest way to run containerized application. If you don't want to use conainerized application(s), then you can also deploy your nodejs or python based services on AWS App Runner from Github.


Let's connect:

Linkedin: https://www.linkedin.com/in/mubbashir10/

Twitter: https://twitter.com/mubbashir100

Top comments (0)