From Code to Cloud in Minutes: AWS App Runner, No Ops Needed!
AWS App Runner is designed for developers who want to focus on writing code without worrying about the complexities of managing infrastructure. With AWS App Runner, you can seamlessly deploy your applications from code to the cloud in just a few clicks, eliminating the need for in-depth operational tasks like server configuration, scaling, or load balancing. This fully managed service automatically handles all the heavy lifting, allowing you to deploy scalable web applications and APIs within minutes. If you want to accelerate your development process and stay focused on building features, AWS App Runner has you covered — no ops required!
Key Features of AWS App Runner
1. Fully Managed Service
- Automatically handles provisioning, scaling, and load balancing.
- Eliminates the need to manage servers, clusters, or orchestration tools like Kubernetes.
2. Source-to-Deployment Pipeline
- Directly integrates with source code repositories like GitHub.
- Supports seamless deployment of containerized applications from container registries like Amazon Elastic Container Registry (ECR).
3. Built-in Auto Scaling
- Automatically adjusts the number of instances based on traffic, ensuring optimal performance and cost-efficiency.
4. Secure by Default
- Provides TLS encryption for in-transit data by default.
- Easily integrates with AWS Identity and Access Management (IAM) and AWS Secrets Manager for secure authentication and environment variable management.
5. Health Monitoring
- Includes automatic health checks and service restarts to maintain availability and performance.
6. Zero Infrastructure Management
- Abstracts the underlying infrastructure, allowing you to focus solely on your application code.
7. Language and Framework Agnostic
- Compatible with any programming language or framework, as long as the application is containerized.
8. Event-Driven Architecture
- Supports event-driven triggers for deploying new versions of your application when changes are pushed to a source repository.
Business Use Case: Deploying a Small Web Portal with AWS App Runner
Scenario: Hosting a User Feedback Portal
You’ve developed a small web portal using Python Flask (or Django) to collect feedback from your end users. The portal allows users to submit feedback, track their submissions, and view updates. You want to deploy this portal quickly and ensure it remains available and scalable without managing any underlying infrastructure.
Why AWS App Runner is the Perfect Fit:
1 .Quick and Easy Deployment:
- Directly deploy your Flask or Django application from a GitHub repository or a container registry like Amazon ECR.
- Automate the deployment process using App Runner’s source-to-deployment pipeline.
2. Scalable Web Hosting:
- AWS App Runner automatically scales the number of application instances based on traffic. Whether you’re collecting a handful of feedback entries or thousands during peak times, your portal remains responsive.
3. Secure Environment:
- Enable TLS encryption by default to secure user data during transmission.
- Use AWS Secrets Manager to manage sensitive data such as database credentials and API keys for analytics integrations.
4. Cost Optimization:
- Pay for active instances when users interact with the portal and incur minimal costs during idle times.
5. Focus on Features, Not Infrastructure:
- No need to manage servers, set up scaling policies, or configure load balancers. App Runner abstracts these complexities.
Steps to Implement the Solution:
Creating a service from code using the AWS App Runner console
To create an AWS App Runner service using the console
- Configure your source code.
- Open the AWS App Runner console and select your AWS Region in the Regions list.
- In the Source and Deployment page, in the Source section, choose Source code repository for Repository type.
- Select a Provider Type. Choose either GitHub or Bitbucket.
- Next select an account or organization for the Provider that you’ve used before, or choose Add new. Then, go through the process of providing your code repository credentials and choosing an account or organization to connect to.
- For Repository, select the repository that contains your application code.
- For Branch, select the branch that you want to deploy.
- For Source directory, enter the directory in the source repository that stores your application code and configuration files.
2. Configure your deployments.
- In the Deployment settings section, choose Manual or Automatic.
For more information about deployment methods, see Deployment methods.
- Choose Next.
3. Configure the application build.
- On the Configure build page, for the Configuration file, choose Configure all settings here if your repository doesn’t contain an App Runner configuration file, or Use a configuration file if it does. For our blog, we are using a configuration file.
version: 1.0
runtime: python311
build:
commands:
build:
- pip3 install --no-cache-dir -r requirements.txt
run:
command: python3 app.py
network:
port: 8080
Key Parts of the Configuration
- Runtime: Specifies
python311
as the runtime environment, meaning the application will run in a Python 3.11 environment. - Build Commands: Installs dependencies from the
requirements.txt
file (you can leave it empty if there are no dependencies). - Run Command: Starts the application by running the
app.py
script withpython3
. - Network: Exposes port
8080
, which is where the application will listen for HTTP requests. This port must match what the Python server is configured to use.
4 . Configure your service.
- On the Configure service page, in the Service settings section, enter a service name.
- Optionally change or add other settings to meet your application requirements.
Choose Next.
5. Configure the health check for your application and Choose required KMS key.
6. Configure Networking for the application:
- Choose the type of incoming network traffic. AWS App Runner offers 2 types of incoming network traffic configuration. For our use case, we are using a public endpoint.
- Choose the type of outgoing network traffic. AWS App Runner offers 2 types of outgoing network traffic configuration. For our use case, we are using public access.
7. Review and Create AWS App Runner Service:
On the Review and Create page, verify all the details you entered, and then choose Create and Deploy.
Result: If the service is created successfully, the console displays the service dashboard with a Service overview of the new service.
8. Wait for Service Deployment/Build to be completed
- Now wait for AWS App Runnerto to build and deploy your application. If everything goes well, then you will see logs and process as mentioned below
- You can also review the detailed logs in Cloudwatch.
- AWS App Runner seamlessly downloads your code, containerizes it into a Docker-based container, and deploys it — no Dockerfile needed.
- AWS App Runner deployment logs confirm that the application is running smoothly, health checks have passed, and the service is now ready to handle traffic.
- Take note of the AWS App Runner Domain name from the console, which we will use to access our application.
9. Access the application.
Copy and paste the URL into the browser to open the application. As you can see my web portal is up and live for end users.
10. Link AWS App Runner DNS to a Custom Domain:
AWS App Runner Also comes with a custom domain mapping option. You can map a custom domain to provide a better experience to your end users.
- Click on Service go to the custom domains option and click on Link Domain.
- Choose your domain registrar and DNS provider. Here, we’re using Amazon Route 53 with the custom domain
devopscaptain.com
, linking the AWS App Runner DNS to the application. The resulting service URL will beapp-runner.devopscaptain.com
. - After Selecting and clicking on link domain, AWS App RUnner will provide a set of DNS record which we have to configure for completing our linking of Domain.
Real-World Use Cases for AWS App Runner
1. Microservices Deployment
Easily deploy individual microservices with separate scaling and configuration. For example, deploy independent services for user authentication, payments, and notifications.
2. API Hosting
Deploy RESTful or GraphQL APIs that can scale based on demand. Ideal for startups or projects needing a quick API setup without backend management.
3. Modernizing Legacy Applications
Containerize legacy applications and deploy them using App Runner to benefit from auto-scaling and high availability without extensive refactoring.
4. Web Application Deployment
Host frontend applications such as React, Angular, or Vue, or backend frameworks like Flask, Django, or Spring Boot.
5. Proof of Concept (PoC) Applications
Quickly deploy prototypes to validate ideas without committing to heavy infrastructure setup.
6. Event-Driven Applications
Trigger application updates directly from CI/CD pipelines or repository changes.
Pricing
AWS App Runner pricing is based on compute and memory usage and the number of requests your application handles.
1. Compute and Memory Costs
- Active Instances: Charged based on vCPU and memory when the service processes requests.
- Idle Instances: Charged at a reduced rate for instances in a warm (ready-to-serve) state.
2. Requests
- Number of Requests: $0.003 per 1,000 requests.
- Data Transfer: Standard AWS data transfer pricing applies.
Example Cost Calculation:
. A service running with 1 vCPU and 2GB memory:
. Active for 10 hours daily:
. Compute: \( 10 \times (0.064 + 2 \times 0.007) = 0.78 \)
. Idle for 14 hours daily:
. Compute: \( 14 \times (0.007 + 2 \times 0.0012) = 0.13 \)
. Monthly cost: \( (0.78 + 0.13) \times 30 = \$27.3 \) for compute and memory.
Comparison to Other AWS Services
Strengths
- Simplified Deployment: No deep expertise in container management required.
- Cost Efficiency: Pay only for resources used; idle instances are cheaper.
- Rapid Prototyping: Ideal for small teams and startups to test ideas quickly.
Limitations
- Less Customization: Limited control over the underlying infrastructure.
- Fixed Resource Options: Constrained to predefined compute and memory configurations.
- Use Case Boundaries: Not ideal for compute-heavy workloads or applications requiring deep network customization.
AWS App Runner is perfect for developers looking to deploy and scale applications rapidly without dealing with infrastructure complexities. Its real-time scalability, security, and focus on developer productivity make it a strong candidate for modern application development. However, its simplicity comes with trade-offs in customization and control, which developers should weigh against their specific project requirements.
Important Link:
Github Repo for this solution:
https://github.com/Ashishkasaudhan/app-runner-sample-application