The Easiest Way to Deploy an Application in AWS
Take a moment to imagine a magnificent world. A world where you don’t have to worry about infrastructure, a world where you can deploy your application in the cloud without any server configurations. In this world, you have created a Docker image for your application and can simply operate it without any special orchestration technology or difficulty.Wouldn’t it be great if you could even route it through your own domain name in Route53? Well, now all these functionalities are available with AWS App Runner!
App Runner is a new AWS service that allows you to run your applications without creating infrastructure. You can specify your Git repository as the source code for your application, or you can choose to proceed with a Docker image instead. It really is that simple!
Let’s cover all of App Runner’s advantages to gain a better understanding of its use.
App Runner’s Advantages
App Runner helps us run our service in 3 different ways:
- Scalability – You don’t have to manually scale your application when traffic to your application is unpredictable.
- Time saver – As you don’t have to provision any infrastructure or configure any servers, at the edge you save lots of time when deploying your application.
- Easy to use – App Runner has a friendly and simple platform. This means you can allow your developers direct access to test their applications, without having to teach them how to set up the entire environment, without running complex CICD pipelines, and without worrying about affecting your actual environment.
App Runner’s Disadvantages
As you might expect, every solution has both benefits and drawbacks. Let’s understand who should avoid using App Runner:
- Lack of control – Although some may use App Runner for less infrastructure management, others may think of this as a problem. If you need control over specific VPC settings or customized servers, then you should reconsider using it in your environment.
- Supported for a specific type of workloads, App Runner is mostly suited for HTTP/S applications and web application API and is not optimal for long-run workloads or long background processes.
- Unpredictable cost – While App Runner is designed to be cost-efficient, costs can rise unexpectedly, especially with high-traffic applications. Automatic scaling is convenient, but without proper monitoring, you could end up with higher bills than anticipated. Also, you have no free tier in App Runner.
Configuration of App Runner
When you enter the App Runner console, you will specify the option to create a new service. The first thing you need to do is choose the source code location for your application. You can select one out of the two options: storing the source code in a Git repository or containerizing it into a Docker image. As for today, the only available Docker registry is AWS ECR (public or private). If you want to use the Git repository as your application source code, the only available Git registries are GitHub and Bitbucket.
In the deployment section, you can choose to create a webhook that monitors your application and automatically triggers the workflow or build it manually. You can also specify an IAM role that will be used by App Runner (for example, for the private ECR repositories, for logging).
Then, the next steps are to configure the service itself. Starting from specifying CPUs and memory, entering the environment variables and services port, and then you can continue to modify the environment:
- Auto Scaling – Configure how the application should scale.
- Health Checks – To view the service health.
- Security – Modify IAM role for the application, enable encryption at rest using KMS, or deploy Web Application Firewall (WAF) in front of your endpoint.
- Networking – To select if your endpoint is going to be exposed privately or publicly,
- Observability – If you wish to record the traces that run through your environment.
And that’s it! You can proceed and create your service, and AWS App Runner will automatically show you the logs your service generates, so you will know exactly when your application is ready for use.
An important thing to know is the limitations of scaling an App Runner application. You can choose to use the default auto-scaling configuration, or you can create your own one. Generally, auto-scaling is between 1 and 25 instances and can scale to a maximum concurrency of 200 requests per instance.
Route53
By default, App Runner generates a URL that allows you to access your application from the browser, but you can also link your own domain from Route53.
To do so, you must first have a hosted zone in Route53.
Then, in the App Runner console, select your service, navigate to the ‘Custom domains’ section, and click the ‘Link domain’ button. Then, you can configure the record that you want to create and finally access your service with your domain name.
If you don’t want to use Route53 as your DNS solution and you want to bring your domain from other domain registries, you can do so, but you should create the record for it in your other DNS solution.
App Runner vs. Lambda
Let’s discuss the main differences between the App Runner service and AWS Lambda. Both are serverless solutions, and there is no need to worry about stopping using Lambda because it is still a great solution. However, you may find that sometimes it’s easier to use App Runner as an alternative solution for your environment.
While the deployment model in Lambda functions is based on running single functions, and you deploy your code as a function, App Runner deploys your entire application as long as it is containerized.
You also get charged differently. In Lambda, we are charged based on the number of invocations and execution duration, while in App Runner, we have to pay based on the number of running containers and the compute and memory resources allocated to them.
One last difference that I want to mention is that in Lambda, we are limited to specific programming languages, and in App Runner, you already understand that we have an unlimited number of programming languages as long as we can wrap it up in a Docker image.
Conclusion
To sum up, if you need to test your application source code, allow developers without AWS experience, or quickly deploy your environment in the cloud, then you should definitely check out AWS App Runner as your solution. Of course, it has a different pricing model and will not fit every solution, but it can come in handy to some of you, and I hope that you can see the potential hidden in this service, as I can tell so far.