Deploy containerized services on AWS App Runner
Tags: aws, devops, node, docker
Published: 2021-09-05 11:38:15

---
series: Containers on AWS
---
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](https://dev.to/mubbashir10/push-docker-images-to-aws-ecr-4l7e).
***

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

![AWS App Runner from AWS Console](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktae9to3ah9o4x7o9ksp.png)

From there click on "Create an App Runner service"
![Create an AWS App Runner service](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebj2wabitnrljnzw3t16.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i4tie8s2m3mdepe90p0f.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/op4v1sh0k480v2s4g7r6.png)


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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1al6rqson0tz9go3cmrx.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kpifccb1zlrc294i8sn3.png)

- **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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bck8bbxt28w30h2kric1.png)

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/](AWS IAM console) 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/](AWS Key Management Service).

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

![AWS App Runner with AWS KMS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kt4lodp54w43ajv4rd0r.png)


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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/joblvxgjwrc9keuz91d8.png)

Review your configurations and click "Create & Deploy"
![Create and Deploy AWS App Runner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ba8jo8kmi1m36wu5l9a.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a6puu2cclbnb6tznxfv0.png)


Let's make some changes to your code and push it (build the docker image and push to [AWS ECR](https://dev.to/mubbashir10/push-docker-images-to-aws-ecr-4l7e) - you will notice that the build process triggers automatically and deploys the new version

![CI/CD in AWS App Runner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87qwod9shu49lprd82rm.png)


**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](https://dev.to/mubbashir10/the-easiest-way-to-deploy-services-on-aws-using-app-runner-3pf2) or python based services on AWS App Runner from Github.

---
Let's connect: 

Linkedin: [https://www.linkedin.com/in/mubbashir10/](https://www.linkedin.com/in/mubbashir10/) 

Twitter: [https://twitter.com/mubbashir100](https://twitter.com/mubbashir100)