The Ultimate Guide To Google Cloud Run
Discover what Google Cloud Run is, how it works and how to get started with Cloud Run.
Last year, Google announced a new service for its Google Cloud platform – Cloud Run. It comes under Google’s suite of serverless products and shares a few similarities in features, benefits, and integrations with existing serverless products. This means if you’re aware of the Google Cloud ecosystem, Cloud Run can be a little confusing.
We’ve created this guide with our Google Cloud certified team of engineers to help you understand what Google Run is, how it works, its main features, uses, and more.
What is Google Cloud Run?
Cloud Run is a compute platform that is a managed platform that cuts down the number of things you need to go to get your mobile app, website, or online workflows off the ground. It gives developers the ability to upload their code in the form of stateless containers in a Serverless environment which means you no longer have to worry about infrastructure management.
One of the ways Google Cloud Run is different from other cloud solutions is that it is fully-managed. Cloud solutions are vastly superior in terms of ease of usage, scalability, and agility compared to conventional tools. But not everyone is looking for this level of control. Some people just want to get their apps online. This is where managed services come in.
Managed services like Google Cloud Run do most of the heavy-lifting and complex decision-making for you which means you:
- Do not have to ponder over compute and storage requirements, provisioning, and configurations.
- Do not have to worry about over provisioning resources and paying for more than you will use.
- Can focus on innovation and product enhancement
- Eliminating server maintenance costs
- Need fewer developers to get a project up and running
- Get far better scalability, compared to traditional serverless services
- Significantly reduce cloud costs
Cloud service providers have made a lot of progress in making serverless solutions more accessible and affordable – Cloud Run is the next step in that direction. In fact, it is one of, if not, the easiest way for companies to go serverless.
How is Cloud Run Different from Other Managed Services?
There are quite a few cloud services including serverless solutions that can lighten your load by provisioning and configuring automatically. However, most of them suffer from some major disadvantages. For instance, traditional serverless solutions will often support only a few languages and libraries, thus limiting your workflow. Worse yet, if you’ve already written your code, you might have to make major changes for compatibility and rehosting.
But with Cloud Run, almost all of these concerns go out the window. It’s an extremely versatile and easy to use platform that brings ease of managed services and your favorite languages, libraries, and dependencies.
How Google Cloud Run Works
Cloud Run works using stateless HTTPS containers. If you already have a stateless container, then you’re ready to go because that’s basically all you need to go serverless with cloud run. If not, you can write your code in the language of your choice using the framework and libraries that are best for your project. Once that’s done, you can package your code into a container with a single command.
With that, your app is now on the cloud and easily accessible to all of your users (no matter how many). You didn’t have to do any provisioning, configuring, or infrastructure management because Cloud Run took care of everything for you. In the future, as your business grows, Cloud Run will automatically scale up (and down, on slow days) to ensure you only pay for what you use.
You can use Cloud Run for web apps, mobile APIs, websites, backends, and more. Here’s a brief illustration outlining the process of deploying a simple web application on Cloud Run:
To create a serverless web application, you just need to:
Step 1:Upload your container image. If you don’t already have a container, you can package your existing code into a container in minutes and with very little effort.
Step 2:Specify a combination of memory vs CPU resources as well as allowed concurrencies within the image.
Step 3:Click Create and that’s it!
Within seconds, your serverless microservice goes live as a web application. More importantly, Cloud Run is a fully-managed compute platform which means it’s highly automated (less work for developers) and will scale up and down according to traffic. One of the few requirements for Cloud Run to work is that the container needs to be stateless because Cloud Run creates multiple instances of the application to scale it up or down. The rest of the requirements as outlined by Google’s Container Contract are:
- The container is compiled for 64-bit Linux
- The container listens for HTTP requests on port 8080
- Can fit in up to 2GB of memory
- Container instances must start an HTTP server within four minutes after receiving a request
- Your application should work as containers are auto-scaled from 0 to multiple running instances
The Cloud Run platform is also based on an open-source standard Knative so you can deploy your application in four ways:
- Run your containers either fully managed with Cloud Run
- Run your application in your Google Kubernetes Engine cluster for easier management
- Run your application in on-premises workloads with Cloud Run for Anthos.
- Or run it in a completely different cloud!
This means that there is no vendor lock-in with Cloud Run – you’re free to use any platform or service that you want.
The Best of Cloud Run Benefits
There are many things that make Cloud Run such a powerful tool for cloud computing. Here are four of them:
Freedom in Languages, Binaries, and Dependencies
Limitations are almost non-existent when it comes to choosing how to code. Cloud Run allows developers to choose from their favorite programming languages like Go, Python, Java, Ruby, Node.js, and more. You can also use any operating system libraries and even your own custom binaries.
You also have the choice to pair your container images with popular ecosystems such as Cloud Build, Artifact Registry, Docker.
The next big reason to choose Cloud Run is portability. Unlike most other similar cloud computing platforms, Cloud Run allows companies to avoid vendor lock-in by giving you the option to move your containers across different platforms, off-premises, VMs, and more. Cloud Run is also based on the open-source standard Knative.
Furthermore, can you also move your applications around or integrate them with other Google cloud services such as the Kubernetes Engine.
Great Testing Potential
Cloud Run containers are complete, independent web servers in themselves which make them great for testing. Developers can also do remote and local testing more easily with Cloud Run.
Highly Scalable and Simple Pricing
When starting on a new project, it’s easy to get worried about resource allocations and configurations – not with Cloud Run, though. Cloud Run is extremely scalable, responsive, pretty much plug and play. The pricing, along with a free plan is another great reason to get started with Cloud Run.
Cloud Run Pricing
In a recent article, we covered how Google Cloud (the entire platform) has one of the best pricing systems in the cloud services market. That theme continues with Cloud Run. First of all, Cloud Run is highly scalable and can scale down to zero. This means when the platform sees no requests, it will effectively shut down until the next request comes in, allowing you to pay only for the resources you use and nothing else.
Customers are billed down to the nearest one-hundredth millisecond or 0.1 of a second. Google Cloud has a handy cost calculator that you can use to find exact prices for your use cases (for all Cloud services, not just Cloud Run).
Google also offers an Always Free plan that includes 180,000 vCPU-seconds of CPU, 360,000 GiB-seconds of memory, and 2 million requests every month.
Working with the Google Cloud Ecosystem
The Google Cloud ecosystem consists of hundreds of cloud-based services based on artificial intelligence, security, compute, storage, data analysis, and more – everything that a developer might need to make their vision of their dream app into a reality. And the best part, all of these powerful tools are on one platform which eliminates any need for third-party services, saving cost, time, and headache.
Many of these cloud services can be integrated into Cloud Run to take app development to the next level. For instance, developers can use Cloud Run with Kubernetes Engine for greater control over microservices, Cloud Code, and Cloud Build for continuous deployments, Cloud Monitoring, Cloud Logging, and Error Reporting to ensure the app is performing as it should, and a lot more.
Cloud Run vs. App Engine: Which is Better?
The short answer is that neither is “better” than the other. They’re both made by the same company so if one was better, it could’ve cannibalized the other. The reason these two services exist is that they serve different customers with slightly different use cases.
It’s true – you can create a simple web application within minutes on App Engine as well. It too is a fully managed platform. But Cloud Run is undoubtedly more powerful in terms of what can be achieved – but the skill ceiling is also higher. Traditional developers might find App Engine more suited for these uses while DevOps engineers will likely find Cloud Run to be the better option of the two.
Getting Started With Cloud Run in 2020
Cloud Run is extremely easy to get started with – that’s one of its biggest strengths. However, being easy shouldn’t be confused with being limited. In the right hands, Cloud Run is extremely powerful but since it’s created as a platform for Cloud and DevOps engineers that are proficient with microservices, instead of traditional web developers, your initial mileage may vary.
That said, you can ensure a smooth transition from legacy apps to serverless applications on Cloud Run by partnering with D3V Tech, a cloud solutions development firm and home to cloud-certified engineers and developers. If you’d like to learn more about what your company can do with Google Cloud, feel free to get in touch.