A Comprehensive Guide to Cloud Computing: Deployment, Services, and Providers (Part 2)
Author: Aleksandr Volochnev
This is the second in a two-part series on going cloud-native by hooking a Kubernetes-powered demo app to GKE. Here, we discuss how to deploy Apache Cassandra® on AWS, Azure, and GCP, and show you how to take your app to the cloud with GCP. To revisit the basics of cloud computing, check out Part 1.
Welcome to the next step on your journey to deploy Kubernetes (K8s) apps to the cloud using Google Cloud Platform (GCP). As a reminder, in Part 1 we gave you a refresher on the cloud and discussed different cloud deployment and service models.
In this second post, we’ll walk you through deploying Apache Cassandra®, the infinitely scalable NoSQL powerhouse, on the cloud using various cloud service providers.
Then, we’ll guide you through hands-on exercises to take a demo K8s app to the cloud using Google Kubernetes Engine and DataStax Astra DB, an open source Cassandra-as-a-service. You can also follow along with our K8s YouTube tutorial and find resources on DataStax Devs GitHub.
The best part is that you won’t have to code much since we’ll be using containers!
The demo app you’ll be taking to the cloud is powered by Kubernetes and backed by Cassandra. The Cassandra-Kubernetes combo helps us resize our Cassandra clusters, which store data from the application easily. All you have to do is tell K8s your requirement and it’ll scale or shrink your clusters accordingly.
Cassandra is also compatible with major cloud computing services like Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP). Let’s look at how you can deploy Cassandra instances on each of them.
Deploying Cassandra on Amazon Web Services (AWS)
In the world of cloud providers, Amazon reigns as the market leader with 24 regions and 77 availability zones. It offers more than 250 services, making it the most powerful service provider in the industry.
Figure 1 lists some of the most relevant services for developers who want to work with AWS.
There are multiple options to deploy Cassandra on AWS — you can run it on a bare metal machine or go completely serverless. We discuss which AWS services will best suit each requirement in greater detail in our K8s YouTube tutorial, but here’s the rundown:
- Infrastructure-as-a-Service (IaaS)
IaaS is the hardest and most traditional way to run Cassandra as it involves managing and running applications, middleware, O/S, runtime and data by yourself.
To deploy Cassandra on AWS, you can instantiate EC2 and install it on virtual or bare-metal machines. You can also use pre-built images and AMIs for Apache Cassandra, but the idea is to patch Cassandra and create a virtual server of your own.
- Platform-as-a-Service (PaaS)
Like Iaas, PaaS also includes purchasing infrastructure, like servers, from the cloud-service provider. But in addition to the infrastructure, you’ll also purchase middleware and the tools needed to support the complete web application life cycle.
In any PaaS, you can use Amazon Marketplace or DataStax Managed Services (DMS) to manage Cassandra. In DMS and DataStax Enterprise, we take care of everything Cassandra for you so you won’t have to deploy it yourself. This is a more modern and flexible approach compared to IaaS.
- Software-as-a-Service (SaaS)
Here, you allow the vendor to take care of everything from applications to networking. You can use DataStax Astra DB on AWS instances without having to handle the database–we do it all for you.
Another option is Amazon keyspaces: a proprietary AWS project that only works with AWS. It offers key Cassandra features like global availability but isn’t fully compatible with it. Also, there’s vendor lock, so you’ll have to deal with technical incompatibilities and incur some switching costs.
- Containers-as-a-Service (CaaS)
CaaS helps manage containers on a large scale in the cloud. This includes starting, stopping, scaling, and organizing containerized workloads. On a CaaS, you can use a Cass-operator in EKS to automate the process of deploying and managing Cassandra in a Kubernetes cluster.
Now that we’ve learnt how to deploy Cassandra on AWS, let’s look at how we can do the same on Microsoft Azure.
Deploying Cassandra on Microsoft Azure
Similar to its Amazon counterpart, Azure lets developers build hybrid, multi-cloud, and on-premise solutions. It also offers several free availability zones and plenty of services, but Figure 2 describes the ten most important services you should know as a developer.
Deploying Cassandra on Microsoft Azure is similar to AWS. The IaaS, PaaS, or SaaS options give you different layers of control and responsibility. You can also use the Cass-operator and run K8ssandra on Azure Kubernetes service. Below is a summary of the options available, which this YouTube video explains each in detail.
—Create virtual machines and install Cassandra
— Prebuilt images for Apache Cassandra
— Azure Marketplace (managed service)
— Datastax DMS
— Use ASTRA on Azure (beta)
— Use Cass-operator in AKS
But our hero for this post is Google Cloud Platform. Let’s see how you can deploy Cassandra with GCP.
Deploying Cassandra on Google Cloud Platform
The Google Cloud Platform is one of the fastest-growing cloud providers with very promising systems and services. It also delivers different services for whatever your needs are. Figure 3 lists the key GCP services that developers should know about.
GCP is trusted by over four million apps and includes application, storage, and cloud computing capabilities for backend, mobile, and web-based solutions. Moreover, GCP gives a $300 free credit on signing up, (which is why we’re using it to deploy our K8s app to the cloud).
Similar to AWS and Azure, deploying Cassandra on GCP through IaaS gives you more control, while the SaaS system gives you fewer responsibilities.
— Use Google Compute engine
— Pre-built images for Apache Cassandra
— Google Cloud Launcher (Marketplace)
— DataStax DMS
— Use ASTRA targeting GCP
— Use ASTRA from Google cloud console
— Use the Cass-operator in GKE
What are Astra DB and Cass-operator?
Astra DB is Cassandra made easy in the cloud. It’s a massively scalable Database-as-a-Service (DaaS) which helps you build multi-cloud, multi-region applications with zero lock-in and zero-ops.
Contrary to popular belief, Astra DB is not a cloud provider but a collection of DataStax’s experts who manage and configure Cassandra databases for you. With Astra DB, you can host Cassandra on AWS, Azure, or GCP based on your preference.
In short, Astra DB gives you the power and reliability of Cassandra combined with rich data APIs and is optimized for developers building cloud-native applications.
On the other hand, the Cass-operator automates the process of deploying and managing open-source Cassandra in a Kubernetes cluster. It makes the process of managing the distributed Cassandra turnkey, freeing up your team so they can focus on the application layer and its functionality.
Now that we’ve looked at how to deploy Cassandra on different cloud service providers, let’s look at another emerging solution to deploy Cassandra.
The rise of functions-as-a-service
Recently, developers have started moving away from traditional cloud service models like IaaS, PaaS, and SaaS to Functions-as-a-Service (FaaS) or serverless solutions because of its many advantages.
FaaS takes away the hassle of managing and maintaining an operating system and servers. As a result, developers can focus solely on individual functions in application code and launch their applications quickly.
With serverless FaaS, you’ll only need to pay for what you consume, which can reduce total cost of ownership (TCO).
If you’re using FaaS, you first need to access functions through several triggers that you define when you create the function. Trigger types include event-source or HTTP API call. Alternatively, services like AWS Lambda can bring your functions to life.
You can deploy functions on all the big cloud providers. For AWS and GCP, there’s Lambda and Google Cloud Functions. But if you’d like a cloud-agnostic serverless solution, check out Serverless or Apache Open Whisk.
To connect functions to Cassandra databases, you’ll need to create a driver connection. Here’s a summary:
- Create a driver connection to the database outside of the function entry point.
- Be aware of the number of client connections to your database.
- Consider query characteristics compared to the function runtime.
- Optionally reduce startup time by disabling driver metadata & pooling warmup.
- Disable the driver heartbeats that ping idle connections.
- Move the data access and business logic away from the function entrypoint.
Now, let’s get hands-on and learn how to take your applications to the cloud using GCP.
Hands-on: Deploy application on GKE1 & GKE2
In the hands-on exercises, you’ll be working with Astra DB. But you can adjust the exercises to work with Cassandra as well.
You can follow along with our K8s YouTube video and click on each link below to access the GitHub for codes.
- Step 1: Prerequisites and setup. Open a new GCP account, add a new project, and create your Google Kubernetes Engine cluster.
- Step 2: Pods and nodeports. Explore your cluster, create Kubernete YAMLs and firewall rules to create and configure pods and nodeports.
- Step 3: Deployments and Load Balancer Services. Create deployments and external contact points to launch the K8 app to the cloud.
Congratulations! You’ve gone from basic cloud computing fundamentals to deploying your K8 app into the cloud with GCP. For more workshops on Cassandra, check out DataStax’s Academy on GitHub and DataStax Devs YouTube channel. If you have any specific questions about Cassandra, join the DataStax Community and get answers from the experts or chat with us on Discord.
- A Comprehensive Guide to Cloud Computing: Deployment, Services, and Providers (Part 1)
- Apache Cassandra
- Astra DB
- GitHub Tutorial: Taking your K8s app to the cloud
- Google Kubernetes Engine
- Amazon Web Services
- Microsoft Azure
- DataStax Community Platform
- DataStax Academy
- DataStax Certifications
- DataStax Workshops