EVENTGet 50% off your ticket to MongoDB.local NYC on May 2. Use code Web50! Learn more >

Cloud Architecture: A Comprehensive Guide

Every developer wants to write the best applications possible. But that’s hard to do when you’re spending valuable time managing your IT infrastructure. With cloud computing and cloud architectures, you can outsource these tasks to specialists who ensure you have secure, available, resilient compute and storage precisely at the minute you need it. With cloud computing, your infrastructure just works, and you can get back to writing great code.

This article will cover the fundamentals of Cloud Architecture and show how MongoDB Atlas, MongoDB’s Data-as-a-Service platform, harnesses cloud architectures to boost productivity, availability and reliability. We will also explain how Atlas App Services can become a key part of such an architecture.

Table of Contents

What Is Cloud Architecture?

Cloud Architecture refers to the way various components combine together to form a cloud environment. Cloud environments offer a wide variety of services and infrastructures on demand with near limitless expansion possibilities. The main elements are:

  • Compute : virtual servers, serverless functionalities (AWS Lambda etc.) , ML etc.
  • Services : SSO, Backend-As-Service, hosting etc.
  • Data: Databases, Storage, Data lakes etc.

Cloud architecture is divided into two types: Frontend and Backend.

MongoDB Example of Cloud Architecture

Frontend Architecture consists of:

  • Secure hosting infrastructure with a network routing
  • Clients or code to interact with the backend

Backend Architecture consists of:

  • Application: Serverless Functions, Triggers, Data access (MongoDB Schema and rules, Data lake connections)
  • Service: Webhooks, external APIs (AWS, Twilio, Http etc.)
  • Storage: Storage layer is our Atlas operational database (Crud and Search), Our long term storage in the form of S3 and Data lake on top of it.

Management & Security underpin all the above components

The way we connect all of those together is considered to be our Cloud native architecture.

Fundamentals of Cloud Architecture

Your cloud architecture may be based on just one type of cloud; more commonly, you may build an architecture that uses several of the four main cloud types working together.

  • Public cloud: The resources are deployed in a secure, publicly available offering such as AWS, Azure or Google Cloud Platform.
  • Private cloud: The infrastructure of the cloud is managed in on-premise data centers, for example Pivotal Cloud Foundry architecture.
  • Hybrid cloud: Components are deployed on both public and private clouds, working together.
  • Multi-Cloud: Components are deployed on several different public clouds.

Preliminary Questions

We should ask ourselves the following questions when considering the design of our cloud architecture :

  • What are we trying to build, and how do we want to provide it to end-users? Are we building a web application, mobile app, a service or an integration component? This will determine our choice of components. For example, for a web application we will probably need to host a frontend with DNS services to route to our site address, a compute layer to provide a backend API, and a database to store data.

  • How do we want our application to scale and grow in the future? Growth could be quick or unpredictable, or possibly spread over many geographies; in those cases, we may need elastic infrastructure and scalable API endpoints.

  • Finally, we need to consider the cost and productivity of our developer teams. Developers shouldn’t be spending significant time managing infrastructure -- that’s something vendors can do more efficiently and cost-effectively.

Using MongoDB Atlas and Atlas App Services allows you to benefit from the power of public clouds, multi-cloud, and hybrid solutions:

  • The database and backend layer are deployed on the public cloud of your choice, allowing you to use different regions and multi-cloud clusters.
  • The legacy systems and connectors from your private cloud can be connected to the MongoDB public cloud environment. Access to the deployment is via the internet or a private endpoint. See more on Atlas security.

What Does a Cloud Architecture Look Like?

A MongoDB Example

Let’s consider a web app that provides a web interface and UI -- for example, a social network with users’ posts. The frontend will be hosted on App Services Hosting and the code will use Javascript Realm to perform authentication and backend tasks using MongoDB Atlas and Realm services.

Example of Web App using MongoDB Cloud

Frontend Architecture:

  • Client side application: The web app that will use a SDK to interface with the cloud-based services.
  • Infrastructure: The hosting facility for the web app.

Atlas App Services provides a client SDK and a hosting service. You could host the frontend code and access the backend with API requests from app.example.com.

Backend Architecture:

  • Application: This where you will define backend logic and expose it via an API to the client side application, to enable CRUD manipulation over the application content.
  • Services:
    • Atlas App Services provides a fully elastic and scalable Backend-as-a-Service with data access governance and application authentication providers (email/password, Google, Facebook , JWT etc.).
    • This layer is where the data rules governance will be executed, such as verifying that the user has appropriate roles to access certain APIs (Functions, Webhooks etc.)
    • We will need to define backend logic and expose it via an API to the frontend, allow authentication and data rules governance, and react to data changes based on events. We can do this using:
      • MongoDB App Services authentication providers to build user identities and authentication pathways with third parties such as Google and Facebook.
      • Atlas App Services functions or third party services for HTTP webhooks to expose the API. For example:
POST https://webhooks.mongodb-realm.com/api/client/v2.0/app/app-abcd/service/test/incoming_webhook/processTask
  • Storage:
    • Operational data will be stored in the MongoDB Atlas cluster. Archived and auditing data is stored on the MongoDB Data Lake. This allows us to offload historical data into a cheaper storage layer, yet with federated queries, we can access all of the dataset as one.
  • Management & Security:
    • Atlas MongoDB Cloud Security and Managed Services (cluster resource management, upgrades, etc)

Cloud Architecture Design Patterns

Although each application and business effort is unique, there is a set of cloud architecture patterns to take into account when designing your cloud architecture.

Scalability Primer

When building an application, whether in the cloud or not, we need to consider expansion as a key aspect of our design. Atlas Scalability is one of the main reasons developers love the MongoDB platform.

Auto-Scaling Pattern

Atlas allows you to scale your databases (Atlas Auto-scaling) and backend seamlessly, while our proactive monitoring tools and advisories highlight any improvements that would benefit your schema design or improve database performance.

Database Sharding Pattern

You can spin up a multi-sharded environment with just a few clicks, and your compute power can be boosted at any time, giving you valuable peace of mind.

Node Failure Pattern

Modern cloud architectures take into account the fact software and hardware can fail. To accommodate such failures, we need to build fault-tolerant components that can be replaced easily or automatically fail over to healthy ones.

In a cloud environment, replacing or rebuilding components is available by design. MongoDB Clusters use replication and replica sets to ensure availability. MongDB Atlas clusters use a three-node deployment for each replica set by default.

Multi-Tenancy Pattern

The elasticity and flexibility of cloud components make them a very good choice for hosting multi-tenant applications. Having said that, there are known multi-tenancy hazards:

  1. Service starvation by one of the tenants - Our design should govern tenant resource allocation to allow large consumers dedicated resources.
  2. Security. What information or credentials should be shared between tenants? How do we control identity management?

MongoDB Atlas allows for flexibility when managing multiple tenants. You can::

  • Deploy a separate application and/or Atlas cluster per tenant or group of tenants.
  • Segregate data within a single application using different databases and collections.
  • Use application logic and rules systems to filter data out of multi-tenant collections.

Multi-Site Deployment Pattern

Users expect perfect uptime and availability, making disaster recovery and high availability crucial parts of our implementation process. It’s best to deploy applications on several regional sites to ensure availability when a single site or an entire cloud is down or unavailable.

MongoDB Atlas and Atlas App Services allow applications and database clusters to be deployed over multiple regions with automatic failover and repair processes.

Cloud Architecture and MongoDB

The world of cloud architecture is big and getting bigger, however, MongoDB Atlas and Atlas App Services offer a wealth of features to build cloud-first applications:

  • Scalable MongoDB Clusters, cloud agnostic with workload isolation
  • Data Lake to store masses of data for low costs
  • Realm serverless platform
  • Realm mobile database with offline-first sync to the cloud
  • Charts, APIs and more

Ready to get started?

You can start as small as a free tier cluster and grow your application and business to multi-terabyte cross region/cloud clusters.

FAQ

What is cloud architecture?

Cloud Architectures is a topology of components deployed in a cloud type and accessed via a network to build your system.

How does cloud architecture work?

The deployed set of components are integrated and connected using cloud fundamentals like compute, networking and storage tiers. Cloud architectures allow you to scale as needed and expose your system to the outside world.

What are the use cases of cloud based services and cloud architectures?

  • Infrastructure as a Service (IaaS)
    • Build your Cloud Computing stack on basic infrastructure building blocks such as Virtual Servers, Storage, Networking and Security.
  • Platform as a Service (PaaS)
    • The building blocks of this architecture provide a fully managed platform as a resource for your application stack. Examples: Atlas App Services Cloud.
  • Software as a service (SaaS)
    • Build your Cloud Computing Stack using software provided as a service such as MongoDB Atlas and Atlas App Services Features (Sync, Authentication etc).
  • Front-end as as service (FaaS)
    • Services that allow you to host and provide front-end hosting and runtime to your application. Examples: App Services Hosting , Netlify etc.
  • Development as a service (DaaS)
    • Development as a service allows your architecture to be fully developed/tested and deployed in the cloud. With the help of tools like GitHub and Atlas App Services auto deployment, you can build your CI/CD directly in the cloud. Additionally MongoDB Atlas and Realm have built-in IDEs, revision mechanism and Data explorers to code directly on your cloud deployment.

What is PaaS vs SaaS?

PaaS (Platform as a Service) allows you to build, deploy and maintain your applications using a complete platform: hardware, software and infrastructure. SaaS (Software as a Service) on the other hand, provides you with software offerings hosted and installed for you including licensing and maintenance, upgrades etc.

What are the layers of cloud architecture?

  • Networking : DNS, Internet Gateways, Internal networking

  • Compute Layer

  • Data layer

    • Database
    • Data Lakes
    • Storage

What type of architecture is cloud computing ?

Cloud computing architecture is a combination of service-oriented architecture, event-driven architecture and data-driven architecture hosted on a cloud.

What is the 4 types of clouds in cloud computing?

  • Public
  • Private
  • Hybrid
  • Multi-Cloud

How do you design a cloud architecture?

You design a cloud architecture by applying cloud best practices and the relevant cloud design patterns for your business needs. Starting with small scale models and expanding them in the future is a recommended approach.

What are the main components of cloud infrastructure?

  • Virtual Hosts
  • Virtual Networks
  • Virtual Storage

Is the cloud an infrastructure?

Yes. One type of cloud computing service is providing infrastructure as a service.