DEV Community

GargeeBhatnagar for AWS Community Builders

Posted on • Updated on

AWS App Runner : How to deploy containerized applications using App Runner

“Problems faced while running the container image with pipeline and issue of time and handling infrastructure''. I have tried to find out certain solutions from a scalable and cost perspective. Instead of creating a pipeline, AWS App Runner made my work easy. It Is easy to configure, there is no issue of scaling and can create a default domain. In terms of cost, charges are based on an hourly basis. Also, app runner has a benefit as it is easy to use, scales with traffic and saves time.

A keyword define "Devtron" play an important role in sorting the complexity of DevOps, AppOps and Kubernetes. Also "GitHub" helps to integrate and automate. Both Devtron and GitHub is an open source one.

In this post, you will get to know how to deploy containerized applications using app runner. Here I have used a aws cli to build the image and push it on ECR and then run it using app runner.

Prerequisites

You’ll need AWS Command Line Interface (AWS CLI) installed and configured on your machine. For this blog, I assume that the default AWS CLI region is set to oregon (us-west-2) and that you have access to the AWS services described in this post. If you use other regions, you should check the availability of AWS services in those regions.

NOTE : You can also use an Amazon EC2 Server for AWS CLI. Checkout Getting started with amazon EC2 provides instructions on how to launch an EC2 Server.

Architecture Overview

Image description
The architecture diagram shows the overall deployment architecture with data flow, application server, local machine, Amazon ECR, AWS App Runner.

Solution overview

The blog post consists of the following phases:

  1. Create a repository and push container image to ECR
  2. Created role for App Runner ECR Access
  3. Configuration of App Runner with ECR container image
  4. Testing output and logs of App Runner

I am using a local machine to build the container image as below (Docker, Git and AWS CLI are installed on the local machine) →
Image description

Phase 1: Create a repository and push container image to ECR

  1. Open the local terminal, Created a repository in ECR named as hello-app-runner. Then done the authentication with Login succeeded. Then build the image then push it to ECR. Image description Image description Image description Image description Image description Image description
  2. Image tagged with name as latest. Image description

Phase 2: Created role for App Runner ECR Access

  1. Created a role named AppRunnerAccessRole and a policy named AWSAppRunnerServicePolicyForECRAccess. Image description Image description Image description Image description

Phase 3: Configuration of App Runner with ECR container image

  1. Open the AWS App Runner console, Click on create an App Runner service button. In the source section: choose the repository type as container registry, provider as Amazon ECR, input container image URI, Process set as automatic and role created as AppRunnerAccessRole then click next. Image description Image description
  2. Give the service name as hello-app-runner and leave the other settings as default. Review and create the configuration and then click on the create and deploy button. Image description Image description Image description Image description Image description Image description Image description Image description

Phase 4: Testing output and logs of App Runner

Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description
Image description

Clean-up

Delete Amazon ECR Repository.
Delete the AWS App Runner Service.

Pricing

I review the pricing and estimated cost of this example.
Cost of EC2 Container Registry (ECR) = $0.10 per GB-month of data storage = $0.004 GB-Mo.
Cost of AWS App Runner = $0.007 / GB-hour, $0.064 / vCPU-hour, $1 per application per month(Automatic Deployment), $0.005 per build-minute(Build Fee) = $(0.007+0.384+1+0.1) = $1.491
Cost of Data Transfer = $0.0
Cost of Simple Notification Service = $0.0
Cost of Cloudwatch = $0.0
Total Cost = $(0.004+1.491+0.0+0.0+0.0) = $1.495

Summary

In this post, I had shown you how to deploy containerized applications using app runner.

For more details on Amazon Elastic Container Registry, Checkout Get started Amazon Elastic Container Registry, open the Amazon Elastic Container Registry console. To learn more, read the Amazon Elastic Container Registry documentation. For more details on AWS App Runner, Checkout Get started AWS App Runner, open the AWS App Runner console. To learn more, read the AWS App Runner documentation.

For more details on Devtron and GitHub, Checkout Links:
Devtron Website
GitHub Repo
Join the Discord Community
Follow on Twitter
Raise feature requests, suggest enhancements, report bugs
Read Devtron Blog

Lets quickly adopt and try it! And post the response using #AdoptK8sWithDevtron #devtron

The above blog is submitted as part of 'Devtron Blogathon 2022' - https://devtron.ai/
Check out Devtron's GitHub repo - https://github.com/devtron-labs/devtron/ and give a ⭐ to show your love & support.
Follow Devtron on LinkedIn - https://www.linkedin.com/company/devtron-labs/ and Twitter - https://twitter.com/DevtronL/, to keep yourself updated on this Open Source project.

Thanks for reading!

Connect with me: Linkedin
Image description

Top comments (0)