Ir al contenido
Londres, Reino Unido · Fundado en 1994
Español

Unit 3: Designing Cloud Applications

How modern cloud applications are designed for resilience and scale, and how containers, orchestration and serverless services change the way software is built and run.

Unit 3 of 5 · about 54 minutes

3.1 Principles of resilient cloud architecture

Cloud architecture is the high-level design of how an application's components fit together in the cloud. A good architecture meets the needs of users and the organisation, keeps working when parts fail, and can be operated and paid for sensibly. Large cloud providers publish frameworks of good practice, often called "well-architected" frameworks, which share a common set of themes. This lesson draws on those shared principles.

Six areas to balance

  • Operational excellence: running and monitoring systems well, automating routine work and learning from incidents.
  • Security: protecting data, systems and identities, covered in detail in Unit 4.
  • Reliability: recovering from failures and meeting expected levels of availability.
  • Performance efficiency: using the right resources so the system responds quickly as demand changes.
  • Cost optimisation: delivering the needed outcome without unnecessary spending, covered in Unit 5.
  • Sustainability: reducing the energy and environmental impact of workloads, for example by avoiding idle resources.

These areas often pull against each other. Running in three regions improves reliability but increases cost. Good architecture is about making these trade-offs consciously, rather than maximising one area by accident.

Design for failure

In large systems, individual components fail regularly: disks break, instances stop, networks become briefly congested. A central principle of cloud design is to assume that any single component can fail and to arrange things so that the service continues. This is achieved by:

  1. Removing single points of failure, such as a lone server or a database without a standby copy.
  2. Spreading components across availability zones.
  3. Using health checks so that load balancers stop sending traffic to unhealthy components.
  4. Retrying sensibly when a request fails briefly, while avoiding endless retries that make problems worse.
  5. Degrading gracefully, so that if a non-essential feature such as product recommendations fails, customers can still place orders.

Loose coupling

In a tightly coupled system, components depend directly on each other, so a delay in one causes delays everywhere. In a loosely coupled system, components communicate through well-defined interfaces and often through intermediaries such as message queues. For example, when a customer places an order, the website can place a message on a queue and reply immediately, while separate components handle payment confirmation, stock updates and emails in their own time. If the email service is briefly unavailable, messages simply wait in the queue.

Many modern applications are built as microservices: small, independent services, each responsible for one business capability and deployable on its own. Microservices can help large teams work independently, but they add complexity in monitoring and communication. For small applications, a single well-structured application is often simpler and perfectly adequate.

Recovery objectives

Two measures help organisations decide how much resilience they need:

  • Recovery time objective (RTO): the maximum acceptable time to restore a service after an incident.
  • Recovery point objective (RPO): the maximum acceptable amount of data loss, measured in time. An RPO of one hour means losing no more than the last hour of changes.

An internal staff newsletter might tolerate an RTO of a day. A payment system might need an RTO of minutes and an RPO close to zero. Tighter objectives require more sophisticated, and more expensive, designs, such as continuously replicated standby systems in a second region.

Remember: Resilience should be set by business need, not by technical enthusiasm. Agree the RTO and RPO with the people who own the service before choosing a design.

Observability

You cannot manage what you cannot see. Cloud applications should produce logs (records of events), metrics (measurements such as response time and error rate) and, in more complex systems, traces that follow a request through several components. Alerts should notify the right people when agreed thresholds are crossed, and dashboards should show the health of the service at a glance.

In practice

When reviewing a design, ask four simple questions. What happens if any single server, or an entire availability zone, fails? How long could the business tolerate the service being down, and how much data could it afford to lose? How would we know something was going wrong before customers told us? Which trade-offs between cost and resilience have been made, and who agreed them? A design that has clear answers is far more likely to perform well in real conditions.

3.2 Containers and orchestration

Containers have become one of the most common ways to package and run software in the cloud. They solve a long-standing problem: an application that works perfectly on a developer's laptop fails on a server because of a different operating system setting, a missing library or a conflicting version of some software.

What a container is

A container packages an application together with everything it needs to run, such as libraries, settings and runtime components, into a single standard unit. The package is built from a container image, a read-only template that can be stored in a registry and used to start identical containers anywhere a compatible container engine is available.

Containers differ from virtual machines in an important way. A virtual machine includes a full operating system of its own. Containers share the host operating system's core, called the kernel, and isolate only the application and its dependencies. As a result, containers are much smaller, start in seconds or less, and many more of them can run on the same hardware.

FeatureVirtual machineContainer
IncludesFull operating system plus applicationApplication and its dependencies only
Typical sizeGigabytesMegabytes to a few hundred megabytes
Start-up timeMinutesSeconds or less
IsolationStrong, at hardware levelGood, at operating system level

Why teams use containers

  • Consistency: the same image runs in development, testing and production, reducing "it worked on my machine" problems.
  • Portability: containers can run on different clouds or on-premises, which can reduce dependence on a single provider.
  • Efficiency: more workloads fit on the same hardware.
  • Speed of delivery: new versions can be built, tested and released quickly through automated pipelines.

Orchestration

Running a handful of containers by hand is manageable. Running hundreds across many servers is not. Container orchestration platforms automate this work. They decide which server each container runs on, restart containers that fail, scale the number of copies up and down, route network traffic to healthy containers and roll out new versions gradually.

The most widely used orchestration system is Kubernetes, an open-source project originally developed at a large technology company and now maintained by an independent foundation. All major cloud providers offer managed Kubernetes services, in which the provider runs the control components and the customer manages the workloads. Providers also offer simpler container services for teams that want to run containers without managing a full orchestration platform.

A key idea in orchestration is desired state. Instead of giving step-by-step instructions, the team declares what it wants, such as "three copies of this version of the web service, each with this much memory". The orchestrator continually compares the actual state with the desired state and makes changes to close any gap.

Container security basics

  1. Build images from trusted, minimal base images and keep them updated.
  2. Scan images for known vulnerabilities before they are used.
  3. Never store passwords or keys inside images; use a dedicated secrets management service.
  4. Run containers with the fewest permissions they need.
  5. Control who can push images to the registry and deploy to the cluster.

Tip: Kubernetes is powerful but complex. For a small team with a few applications, a simpler managed container service or a PaaS offering may deliver most of the benefits with far less operational effort.

Containers and DevOps

Containers fit naturally with DevOps, a way of working that brings development and operations teams together, and with continuous integration and continuous delivery (CI/CD). In a typical pipeline, every code change automatically triggers a build of a new image, automated tests, a security scan and, if all checks pass, deployment to a test environment and then to production. This allows smaller, more frequent and less risky changes.

In practice

If your organisation is considering containers, useful questions include: which applications would benefit most, such as those that change often or must run in several environments? Do we have, or can we build, the skills to operate an orchestration platform, or would a managed service suit us better? How will we keep images patched and secure? Answering these early avoids adopting a complex platform for its own sake.

3.3 Serverless and managed services

"Serverless" is one of the most misunderstood terms in cloud computing. Servers are still involved, but the customer never sees or manages them. The provider automatically supplies, scales and maintains the underlying infrastructure, and the customer pays only when their code or service is actually doing work.

Functions as a Service

The best-known form of serverless computing is Function as a Service (FaaS). Developers write small pieces of code, called functions, each designed to respond to a particular event. Examples of events include:

  • a file being uploaded to object storage;
  • a request arriving at a web address;
  • a message appearing in a queue;
  • a scheduled time, such as every night at midnight.

When the event happens, the platform runs the function, and when there are no events, nothing runs and, in most pricing models, nothing is charged for compute. For example, when a customer uploads a photograph, a function might automatically create a thumbnail, check the file type and record details in a database.

Beyond functions

Serverless also describes a wider group of fully managed services that scale automatically and charge by use, such as serverless databases, messaging services, workflow tools and data analytics services. Combining these allows teams to build complete applications without managing any servers directly.

Benefits

  1. No server management: no operating systems to patch or capacity to plan.
  2. Automatic scaling: from zero to very high volumes and back again.
  3. Paying for use: well suited to workloads that are irregular or unpredictable.
  4. Speed: teams can build and release small features quickly.

Limitations

  • Cold starts: a function that has not run recently may take a little longer to respond the first time.
  • Time and resource limits: functions usually have a maximum running time and memory, which makes them unsuitable for long, heavy processing jobs.
  • Cost at steady high volume: for workloads that run constantly at high load, reserved instances or containers can be cheaper.
  • Complexity of many small parts: an application built from many functions and services can be harder to test, monitor and understand.
  • Provider dependence: serverless services are often specific to one provider, which can make moving elsewhere harder.

Remember: Serverless shifts operational work to the provider, but it does not remove the customer's responsibility for code quality, data protection, access permissions and cost monitoring.

Choosing a compute approach

By now you have met three broad approaches to running applications: virtual machines, containers and serverless. A simple way to choose is to start with the highest-level, most managed option that meets your needs, and move down only when there is a clear reason.

  • Use SaaS if a suitable product already exists.
  • Use serverless for event-driven tasks, irregular workloads and simple web back ends.
  • Use containers for applications that need more control, run continuously or must be portable.
  • Use virtual machines for older software, specialist configurations or applications that cannot easily be changed.

Avoiding lock-in sensibly

Lock-in is the difficulty and cost of moving away from a provider. Some lock-in is the price of using convenient, powerful services, and avoiding it entirely can mean giving up real benefits. A balanced approach is to understand where lock-in exists, keep data in formats that can be exported, use open standards where they serve you well, and have at least an outline exit plan for critical systems.

Common mistakes

  1. Choosing serverless for long-running, steady workloads where it costs more than alternatives.
  2. Giving functions broad permissions "to make them work", rather than only the access they need.
  3. Neglecting monitoring because "the provider handles it".
  4. Building a complex web of functions for a problem a single simple application could solve.

In practice

Imagine a small charity that receives scanned donation forms by email a few hundred times a month. A serverless design could save each attachment to object storage, trigger a function to extract the key fields, store them in a managed database and notify a staff member to check anything unclear. The charity pays very little during quiet periods and has no servers to maintain, while staff still review the results.

Case study: Modernising a booking system at a leisure centre group

Aldermoor Leisure, a fictional group running eight sports centres, had a class-booking system on two ageing virtual machines. When popular classes opened for booking each Monday at 7am, the system often slowed to a halt, and a failure in the email component sometimes blocked bookings altogether.

The digital team agreed recovery objectives with the operations director: no more than fifteen minutes of downtime and no more than five minutes of lost bookings. They then redesigned the system. The booking application was packaged in containers and run on a managed container service across two availability zones, with autoscaling ahead of the Monday rush. Confirmation emails and text messages were moved to serverless functions triggered by messages on a queue, so a delay in sending emails no longer affected bookings.

Dashboards tracked response times and error rates, with alerts sent to the on-call engineer. The following Monday, the system handled the peak smoothly, and when the text message supplier had an outage, bookings continued and messages were sent once it recovered.

Activity

Choose a business process that involves software, such as handling expense claims or processing online orders. Describe which parts would suit serverless functions, which would suit containers or virtual machines, and which could be replaced by a SaaS product. Then propose a recovery time objective and recovery point objective for the process and justify them in one or two sentences.

Compare with a model answer

A good answer breaks the process into clear steps. For online orders, for example, it might use a SaaS payment provider, run the main shop application in containers behind a load balancer because it is busy all day, and use serverless functions triggered by a queue for order confirmation emails, invoice generation and stock alerts.

It explains its reasoning, such as containers suiting a constantly running application and functions suiting short, event-driven tasks. It proposes realistic objectives, for instance an RTO of thirty minutes and an RPO of five minutes for order taking, because lost orders mean lost revenue and customer trust, while accepting a longer RTO for internal reporting. The best answers mention monitoring and how failures in one part would be kept from affecting the rest.

Key takeaways

  • Good cloud architecture balances operational excellence, security, reliability, performance, cost and sustainability through conscious trade-offs.
  • Designing for failure means removing single points of failure, spreading across availability zones and using loose coupling, for example through message queues.
  • Recovery time and recovery point objectives should be agreed with the business before choosing how resilient a design needs to be.
  • Containers package applications consistently and portably, and orchestration platforms such as Kubernetes manage them at scale using desired state.
  • Serverless services remove server management and charge by use, but have limits and still require good security, monitoring and cost control.

Unit check

Create a free account to answer the check, save your progress and receive your free certificate.

Create a free account Log in
← Unit 2 Unit 4 →
WhatsApp