Slide 1

Slide 1 text

©2024 HASHICORP

Slide 2

Slide 2 text

© HASHICORP 2 Cloud AppMod Engineer @yurynino www.yurynino.dev Yury Niño Roa

Slide 3

Slide 3 text

Provisioning Cell-based Architectures with Terraform

Slide 4

Slide 4 text

©2024 HASHICORP 4 Agenda Cell-based Architectures in Detail Challenging Cloud Disasters Provisioning Cell-based with Terraform Operational Considerations Takeaways

Slide 5

Slide 5 text

© HASHICORP 5 Challenges to face in the Cloud Reliability: Availability - Scalability - Security - Resilience 01

Slide 6

Slide 6 text

©2024 HASHICORP Titanic sank on 15 April 1912 in the North Atlantic Ocean

Slide 7

Slide 7 text

©2024 HASHICORP The Bulkhead Pattern is a type of application design that is tolerant of failure. In a bulkhead architecture, elements of an application are isolated into pools so that if one fails, the others will continue to function. If the hull of a ship is compromised, only the damaged section fills with water, which prevents the ship from sinking. https://learn.microsoft.com/en-us/azure/architecture/patterns/bulkhead†

Slide 8

Slide 8 text

©2024 HASHICORP Bulkhead Pattern https://learn.microsoft.com/en-us/azure/architecture/patterns/bulkhead†

Slide 9

Slide 9 text

© HASHICORP 9 Cell-based Architectures Inspired by Bulkheads 02

Slide 10

Slide 10 text

©2024 HASHICORP A cell-based architecture uses multiple isolated instances of a workload, where each instance is known as a cell. Each cell is independent, does not share state with other cells, and handles a subset of the overall workload requests. This reduces the potential impact of a failure, such as a bad software update, to an individual cell and the requests that it's processing.

Slide 11

Slide 11 text

©2024 HASHICORP

Slide 12

Slide 12 text

©2024 HASHICORP Cell-based Architectures Key Components ● Cell . ● Cell Router . ● Cell Communication Layer . ● Control Plane . ● Extra: Data Plane, Mgmt Plane

Slide 13

Slide 13 text

©2024 HASHICORP Cell-based Architectures The Promise ● Increase the resilience of systems. . ● Are a good option to face downtime. . ● Augment the scalability of microservices. . ● Make clearer complex architectures. . ● Improve the security of distributed systems. . Erica Pisani

Slide 14

Slide 14 text

©2024 HASHICORP Cell-based Architectures The Promise ● Increase the resilience of systems by reducing the blast radius of failures. ● Are a good option to face downtime by forcing fixed-size cells as deployment units. ● Augment the scalability of microservices by favoring a scale-out rather than a scale-up. ● Make clearer complex architectures by packaging and deploying as a cell services. ● Improve the security of distributed systems by applying an additional level of security around cells.

Slide 15

Slide 15 text

© HASHICORP 15 Cell-based Architectures With Terraform 03

Slide 16

Slide 16 text

© HASHICORP 16 Each cell operates independently with its resources. Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process

Slide 17

Slide 17 text

©2024 HASHICORP Hands to Work

Slide 18

Slide 18 text

© HASHICORP 18 Each cell operates independently with its resources. Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process

Slide 19

Slide 19 text

©2024 HASHICORP 1. Design a Cell ● Identify functionalities that can be isolated into individual cells. ● Consider grouping services by their operational needs. ● Equip each cell with the necessary resources. ● Implement effective communication between cells.

Slide 20

Slide 20 text

©2024 HASHICORP CODE EDITOR # Configure Google Cloud Provider # Provision a Cloud Run Function resource "google_cloudfunctions2_function" "default" { project = var.project_id name = "function-cell" location = "us-central1" description = "a new cell" build_config { runtime = "nodejs16" entry_point = "helloHttp" # Set the entry point source { storage_source { bucket = google_storage_bucket.default.name object = google_storage_bucket_object.object.name } } } ● Google Cloud account. ● Cloud Run Functions. ● Databases, Buckets. ● Terraform. 1. Design a Cell

Slide 21

Slide 21 text

© HASHICORP 21 Each cell operates independently with its resources. Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process

Slide 22

Slide 22 text

©2024 HASHICORP 2. Partition a Cell ● Identify partition criteria: location, user ID, request type, or date range. ● Implement routing logic or use an API gateway with criteria to redirect. ● Use this data to adjust partitioning criteria and routing logic. ● Partitioning algorithms: hashing, sharding, round-robin, dynamic.

Slide 23

Slide 23 text

©2024 HASHICORP # Configure an API gateway resource "google_api_gateway_api" "api_cfg" { provider = google-beta api_id = "gateway-router" } resource "google_api_gateway_api_config" "api_cfg" { provider = google-beta api = google_api_gateway_api.api_cfg.api_id api_config_id = "my-config" openapi_documents { document { path = "spec.yaml" contents = filebase64( "openapi.yaml") } } lifecycle { create_before_destroy = true } } CODE EDITOR ● Google Cloud account. ● Cloud API gateway. ● openapi.yaml ● Terraform. 2. Partition a Cell

Slide 24

Slide 24 text

©2024 HASHICORP # Configure openapi.yaml swagger: '2.0' info: title: "gateway-router" description: cell router on API Gateway version: 1.0.0 schemes: - https produces: - application/json paths: /cell/1: get: summary: Greet a user operationId: hello x-google-backend: address: https://cloudfunctions.net/cell/1 responses: '200': description: A successful response schema: type: string CODE EDITOR ● Google Cloud account. ● Cloud API gateway. ● openapi.yaml ● Terraform. 2. Partition a Cell

Slide 25

Slide 25 text

© HASHICORP 25 Each cell operates independently with its resources. Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process

Slide 26

Slide 26 text

©2024 HASHICORP 3. Size the Cell ● Workload Analysis ● Resource Requirements ● Performance Metrics ● Scalability Goals ● Testing and Adjustment

Slide 27

Slide 27 text

©2024 HASHICORP CODE EDITOR # Configure Google Cloud Provider # Provision a Cloud Run Function resource "google_cloudfunctions_function" "function" { name = "function-test" description = "My function" runtime = "nodejs16" available_memory_mb = 128 source_archive_bucket = google_storage_bucket.bu… source_archive_object = google_storage_bucket_object.archive.name trigger_http = true entry_point = "helloGET" } ● Google Cloud account. ● Cloud Run Functions. ● Databases, Buckets. ● Terraform. 3. Size the Cell

Slide 28

Slide 28 text

© HASHICORP 28 Each cell operates independently with its resources. Design Determining each cell's optimal capacity to ensure it can handle. Size Distributing and managing application workload self-contained cells. Deploy On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement Cell-based Architectures The Process

Slide 29

Slide 29 text

©2024 HASHICORP 4. Implement the Architecture

Slide 30

Slide 30 text

©2024 HASHICORP 5. Deploy the Architecture ● Automated Deployment Pipelines ● Blue/Green Deployments ● Canary Releases. https://developer.hashicorp.com/terraform/tutorials/aws/blue-green-canary-tests-deployments

Slide 31

Slide 31 text

©2024 HASHICORP Something is missing

Slide 32

Slide 32 text

© HASHICORP 32 Operational Considerations CI/CD  Observability - Security 04

Slide 33

Slide 33 text

© HASHICORP 33 Each cell operates independently with its resources. Design Determining each cell's optimal capacity to ensure it can handle. Size Focus on three key areas: logging, monitoring, and tracing. Observability On dividing a system's workload among distinct cells to optimize. Partition Ensuring efficient workload management and scalability Implement and Deploy Cell-based Architectures The Process

Slide 34

Slide 34 text

©2024 HASHICORP 6. Observe the Architecture ● Logging Tools. ● Monitoring Solutions. ● Distributed Tracing Systems, ● Services Meshes

Slide 35

Slide 35 text

©2024 HASHICORP Cell-based Architectures Takeaways ● The core concept of cell based architectures is breaking down a system into self-contained units (cells), each with its own resources and functionality. ● Essential elements include the cells themselves, a "cell router" to direct traffic, an inter-cell communication layer, and a control plane for overall management. ● Cell-based architectures offer advantages like improved scalability, resilience, and safer deployments, but introduces complexities in design, implementation, data consistency, and operational overhead. .

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

©2024 HASHICORP Thank you [email protected]