In the year 2021, Amazon Web Services announced various updates whether it is for exam modifications or for new technology services. Out of this, it came up with an application service that is AWS App Runner. This can be considered as a fully managed container application service that helps customers in building, deploying, and running containerized web applications and APIs without any prior containers or infrastructure experience. Just provide source code, a container image, or a deployment pipeline. Then, App Runner automatically:
- builds and deploys the web application
- load balances traffic
- scales on-demand
- monitors application health.
However, AWS App Runner is the easiest way for running a web application on AWS. But, this is just a starting with App Runner. That is to say, in this blog, we will learn everything related to AWS App runner including the features, working, and how to get started with it. So, let’s begin.
AWS App Runner: Overview & Features
For getting a better understanding of the App runner, let’s divide the details into points. This will provide a step by step information about the AWS App Runner.
- Firstly, the AWS App runner is designed with AWS operational, security, and configuration best practices that remove the need for customers for managing infrastructure, servers, or container orchestrators.
- Secondly, App Runner is developed for web-scale. This means that there is no requirement for re-platforming or re-architecting as the business grows. This makes it simpler for customers to rapidly deliver innovative solutions and business value.
- Thirdly, App Runner helps in seamlessly integrating with development workflow for providing the right level of automation for deploying code or container image without any requirement of understanding, provisioning, scaling, or managing any AWS compute, networking, and routing resources.
- Next, AWS App Runner has the complete support of full-stack development with both frontend and backend web applications that use HTTP and HTTPS protocols. However, the applications include API services, backend web services, and websites. Further, this also supports container images including runtimes and web frameworks, Node.js and Python.
- Lastly, this automatically builds and deploys the web application and load balances traffic with encryption. And, it has the ability to scale up or down automatically for meeting traffic needs.
What are the features of AWS App Runner?
There are various features of AWS App Runner that make it a unique and most usable service. Let’s understand them.
1. Automatic Deployments
- While connecting App Runner to code repository or container image registry, App Runner has the ability to automatically building and deploying your application when you update your source code or container image.
2. Load Balancing
- App Runner has the ability to automatically load-balanced traffic for providing applications high levels of reliability and availability.
3. Auto Scaling
- App Runner has a default option to automatically scaling the number of containers up or down for meeting the requirements of your application.
4. Logs & Metrics
- App Runner helps in monitoring and optimizing containerized applications by providing deployment, and runtime logs. Further, this provides a full set of computing metrics with built-in Amazon CloudWatch integration.
5. Certificate Management
- App Runner contains fully managed TLS with no setup required. Moreover, App Runner automatically renews the certificates before their expiration date.
6. Cost Management
- You will get the option to easily pause and resume your App Runner applications by using the console, CLI, or API. Moreover, you will be billed only when the service is running.
Working of AWS App Runner App
App Runner Use Cases
The use cases for App Runner include:
1. Frontend and backend web applications
- Use App Runner for building and running API services, backend web services, websites, and more. Moreover, App Runner supports container images including the runtimes frameworks, web frameworks, Node.js, and Python.
2. Microservices and APIs
- With App Runner, it is possible to run thousands of microservices simultaneously. Moreover, this enables for flexibly scaling each component of your application and fosters increased agility and innovation.
- However, loose coupling also reduces risks to application resiliency.
3. Rapid production deployments
- App Runner supports AWS best practices and technologies for deploying and running containerized web applications at scale. Which further, leads to a drastic reduction in your time to market for new applications and features.
With so many updates in the line, for AWS App Runner there was one new service.
AWS Copilot v1.7 with having support for AWS App Runner
AWS Copilot helps in easily deploying request-driven web services with AWS App Runner in addition to Amazon ECS. Above we have learned about AWS App Runner and how it is helping customers for building, deploying, and running containerized web applications and APIs in just a few clicks.
However, with Copilot, you can deploy to App Runner with a single command and a Dockerfile. Combining both Copilot and App Runner provides customers with a developer-focused interface where Copilot is for provisioning the necessary infrastructure-as-code resources. And, App Runner fully abstracts away the infrastructure management which includes components like load balancing and scaling.
We have understood about AWS App Runner including its features and use cases. Now, it’s time to get started with creating an app runner service. Before that, let’s take a look at basic requirements before creating a service.
Getting Started with AWS App Runner
We know that AWS App Runner is an AWS service used for providing a fast, simple, and cost-effective way for turning an existing container image or source code directly into a running web service in the AWS Cloud. In the below, section, we will use AWS App Runner for deploying applications to an App Runner service.
Prerequisites
Before getting started:
- Firstly, complete the setup steps in Setting up for App Runner.
- Secondly, create a GitHub account.
- Lastly, create a repository in the GitHub account.
1. Creating an App Runner service
The main steps you take for creating service are:
However, for creating an App Runner service based on a source code repository:
1. Configuring your source code.
- Firstly, open the App Runner console. Then, select the AWS region in the Regions list.
- Secondly, if the AWS account doesn’t have any App Runner services yet, the console home page is shown. Then, choose to Create an App Runner service. And, if the AWS account has existing services. Then, the Services page with a list of your services is shown. Here, choose to Create a service.
- Thirdly, choose Source code repository on the Source and deployment page, in the Source section, for Repository type.
- Fourthly, select Add new under Connect to GitHub. Then, provide your GitHub credentials.
- After that, choose your GitHub account name in the Install AWS Connector for GitHub dialog box only if prompted.
- Next, if prompted for authorizing the AWS Connector for GitHub. Then, choose Authorize AWS Connections.
- Now, choose Install.
- Lastly, for Repository, select the example repository you created, python-hello. And, for Branch, choose the default branch name of your repository.
2. Configuring your deployments.
- In the Deployment settings section, firstly, select Automatic. Then, choose Next.
3. Configuring application build.
- Firstly, select the Configure all settings on the Configure build page, for the Configuration file.
- Secondly, provide the following build settings:
- Runtime: Choose Python 3.
- Build command: Enter pip install -r requirements.txt.
- Start command: Enter python server.py.
- Por: Enter 8080.
- Lastly, choose Next.
4. Configuring your service.
- Firstly, enter the service name on the Configure service page, in the Service settings section.
- Secondly, under Environment variables, add a single environment variable. Then, enter any name for Key, enter NAME, and for Value.
- Lastly, choose Next.
- Now, verify all the details you have entered on the Review and the create page. Then, select Create and deploy.
- Lastly, verify that your service is running.
- Firstly, on the service dashboard page, wait until the service Status is Running.
- Then, select the Default domain value. It is the URL to the website of your service.
- A webpage displays: Hello, your name!
2. Changing service code
Here. we will make changes to the source code repository. The App Runner CI/CD capability automatically builds and deploys the change to your service.
For making a change to your service code
- Firstly, navigate to your example GitHub repository.
- Secondly, select the file name server.py for navigating to that file.
- Thirdly, select Edit this file.
- Fourthly, change the text Hello to Good morning in the expression assigned to the variable MESSAGE
- After that, select Commit changes.
- Now, the service Status changes to Operation in progress on the service dashboard page.
- Then, wait for the deployment to end. And, the service Status should change back to Running on the service dashboard page.
- Lastly, check that the deployment is successful. For this, refresh the browser tab where the webpage of your service is shown.
- The page now shows the modified message: Good morning, your name!
3. Making a configuration change
In this, we will make a change to the NAME environment variable value for demonstrating a service configuration change.
For viewing logs for your service
- Firstly, open the App Runner console, and select your AWS Region in the Regions list.
- Secondly, choose services in the navigation pane. Then, choose your App Runner service.
- Thirdly, choose the Configuration tab on the service dashboard page.
- Next, choose Edit in the Configure service section.
- Then, for the environment variable with the key NAME, change the value to a different name.
- After that, choose Apply changes. Here, the App Runner starts the update process. And, the Service Status changes to Operation in progress on the service dashboard page.
- Now, wait for the update to end. Then, the service Status should change back to Running on the service dashboard page.
- Lastly, check that the update is successful. For this, refresh the browser tab where the webpage of your service is shown.
The page now shows the modified name: Good morning, new name!
4. Viewing logs for your service
In this, there is the use of the App Runner console for viewing logs for your App Runner service.
For viewing logs for your service
- Firstly, open the App Runner console, and select your AWS Region in the Regions list.
- Secondly, choose services in the navigation pane. Then, choose your App Runner service.
- Thirdly, choose the Logs tab on the service dashboard page. Here, the console shows a few types of logs in several sections:
- Event log: The console displays the latest events.
- Deployment logs: The console displays a separate log stream for each deployment.
- Application logs: The console combines the output from all running instances into a single log stream.
- Then for, finding specific deployments, scope down the deployment log list by entering a search term.
- After that, for viewing a log’s content, choose View full log or the log stream name.
- Next, select Download for downloading a log. And, select a log stream first for a deployment log stream.
- Lastly, choose View in CloudWatch for opening the CloudWatch console and use its full capabilities for exploring your App Runner service logs.
5. Cleaning up
For deleting your service
- Firstly, choose Actions on the service dashboard page. Then, choose Delete service.
- After that, enter the requested text in the confirmation dialog. And then, choose Delete.
AWS App Runner Pricing
For this service, you will only be charged for the computing and memory resources used by your application. In addition, if you automate your deployments, then, you have to pay a set monthly fee for each application covering all automated deployments for that month. Further, if you select to deploy from source code, then, you have to pay a build fee for the amount of time it takes App Runner for building a container from your source code.
Pricing workings
- App Runner lets you deploy and run applications in container instances. This then consumes compute and memory resources.
- Secondly, while creating an application in AWS App Runner, you configure the amount of memory and vCPU needs for your application to run.
- After that, you select concurrency, a scaling metric for representing the maximum number of simultaneous requests that can be processed by an active container instance.
- Next, when your application is inactive, then, you pay per GB of memory for provisioned container instances that keep your application warm and eliminate cold starts.
- Further, when requests come in, your application responds in milliseconds, and you pay for the vCPU and memory consumed by your active container instances as your application is processing requests.
- Lastly, you are only billed while your application is running. And, App Runner provides options to pause and resume your application through the console, CLI, or API for managing your costs.
1. Provisioned container instances
$0.007 / GB-hour*
- After deploying the application is deployed, you pay for the memory provisioned in each container instance.
2. Active container instances
$0.064 / vCPU-hour*
$0.007 / GB-hour*
- While the application process the requests, you move from provisioned container instances to active container instances. This now consumes both memory and compute resources. Here, you pay for the compute and any additional memory consumed in excess of the memory allocated by your provisioned container instances.
Final Words
At this point, we are well familiar with the AWS App Runner overview, features, and its use cases. Providing a wide range of solutions and products from AWS Partners, App runner is helping customers by providing functionality. Many top companies are now using this service for supporting a variety of capabilities, including monitoring and logging, DevOps practices through infrastructure as code, and accessing database services. So, learning and understanding this will take you far whether it is for business or for organizations it benefits both. Go through the blog to get an overview of App runner and make use of documentation to understand the process of creating an app service.