Skip to main content

Exercises and Projects


1 - Hands-on exercises

Exercise 1: Multi-Provider Terraform

Objective: Create infrastructure on AWS and Azure with Terraform.

Solution
# versions.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
}
}

provider "aws" {
region = "eu-west-1"
}

provider "azurerm" {
features {}
}

# AWS VPC
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"

tags = {
Name = "multicloud-demo"
Environment = "demo"
}
}

# Azure Resource Group
resource "azurerm_resource_group" "main" {
name = "multicloud-demo"
location = "westeurope"
}

# Azure VNet
resource "azurerm_virtual_network" "main" {
name = "multicloud-vnet"
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
address_space = ["10.1.0.0/16"]
}

output "aws_vpc_id" {
value = aws_vpc.main.id
}

output "azure_vnet_id" {
value = azurerm_virtual_network.main.id
}

Exercise 2: Multi-Cluster ArgoCD

Objective: Deploy an application across multiple K8s clusters.

Solution
# Multi-Cluster ApplicationSet
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: demo-app
namespace: argocd
spec:
generators:
- list:
elements:
- cluster: aws-cluster
url: https://eks.aws.example.com
- cluster: azure-cluster
url: https://aks.azure.example.com
template:
metadata:
name: 'demo-app-{{cluster}}'
spec:
project: default
source:
repoURL: https://github.com/myorg/demo-app.git
targetRevision: main
path: kubernetes
destination:
server: '{{url}}'
namespace: demo
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
# Add the clusters to ArgoCD
argocd cluster add aws-eks-context --name aws-cluster
argocd cluster add azure-aks-context --name azure-cluster

# Apply the ApplicationSet
kubectl apply -f applicationset.yaml

Exercise 3: Cross-Cloud VPN

Objective: Connect AWS and GCP via VPN.

Solution
# AWS Side
resource "aws_vpn_gateway" "main" {
vpc_id = aws_vpc.main.id
}

resource "aws_customer_gateway" "gcp" {
bgp_asn = 65000
ip_address = google_compute_address.vpn.address
type = "ipsec.1"
}

resource "aws_vpn_connection" "gcp" {
vpn_gateway_id = aws_vpn_gateway.main.id
customer_gateway_id = aws_customer_gateway.gcp.id
type = "ipsec.1"
static_routes_only = true
}

# GCP Side
resource "google_compute_vpn_gateway" "main" {
name = "vpn-gateway"
network = google_compute_network.main.id
}

resource "google_compute_address" "vpn" {
name = "vpn-static-ip"
}

resource "google_compute_forwarding_rule" "esp" {
name = "vpn-esp"
ip_protocol = "ESP"
ip_address = google_compute_address.vpn.address
target = google_compute_vpn_gateway.main.id
}

resource "google_compute_vpn_tunnel" "aws" {
name = "vpn-tunnel-aws"
peer_ip = aws_vpn_connection.gcp.tunnel1_address
shared_secret = aws_vpn_connection.gcp.tunnel1_preshared_key

target_vpn_gateway = google_compute_vpn_gateway.main.id

local_traffic_selector = ["10.2.0.0/16"]
remote_traffic_selector = ["10.0.0.0/16"]
}

Exercise 4: Unified Monitoring

Objective: Centralize metrics from multiple clouds with Prometheus and Thanos.

Solution
# Prometheus per cluster with remote write
# values-prometheus-aws.yaml
prometheus:
prometheusSpec:
externalLabels:
cluster: aws-prod
cloud: aws
remoteWrite:
- url: http://thanos-receive:19291/api/v1/receive

# Thanos Query
apiVersion: apps/v1
kind: Deployment
metadata:
name: thanos-query
spec:
template:
spec:
containers:
- name: thanos-query
image: quay.io/thanos/thanos:v0.32.0
args:
- query
- --store=prometheus-aws:10901
- --store=prometheus-azure:10901

# Grafana Dashboard
{
"panels": [
{
"title": "Requests by Cloud",
"targets": [
{
"expr": "sum(rate(http_requests_total[5m])) by (cloud)"
}
]
}
]
}

2 - Complete project: Multi-Cloud Application

Architecture

Project structure

multicloud-project/
├── terraform/
│ ├── aws/
│ │ ├── main.tf
│ │ ├── eks.tf
│ │ ├── rds.tf
│ │ └── s3.tf
│ ├── azure/
│ │ ├── main.tf
│ │ ├── aks.tf
│ │ └── database.tf
│ ├── shared/
│ │ ├── cloudflare.tf
│ │ └── vault.tf
│ └── modules/
│ └── ...
├── kubernetes/
│ ├── base/
│ │ ├── deployment.yaml
│ │ ├── service.yaml
│ │ └── kustomization.yaml
│ └── overlays/
│ ├── aws-prod/
│ └── azure-dr/
├── argocd/
│ └── applicationset.yaml
├── monitoring/
│ ├── prometheus/
│ ├── thanos/
│ └── grafana/
└── docs/
├── architecture.md
└── runbooks/

Implementation steps

  1. Base infrastructure

    • Deploy the VPCs/VNets
    • Configure the cross-cloud VPN
    • Deploy the Kubernetes clusters
  2. Platform

    • Install ArgoCD
    • Configure Vault
    • Deploy monitoring
  3. Application

    • Deploy the application via ArgoCD
    • Configure the databases
    • Set up replication
  4. Traffic Management

    • Configure CloudFlare
    • Test failover
    • Validate DR

3 - Review quiz

  1. What is the difference between Multi-Cloud and Hybrid Cloud?

  2. Why use Terraform rather than each cloud's native tools?

  3. How do you avoid vendor lock-in?

  4. What is Data Gravity?

  5. Which tools enable unified Multi-Cloud monitoring?

Answers
  1. Multi-Cloud: multiple public clouds. Hybrid Cloud: public cloud + on-premises.

  2. Terraform offers a unified syntax for all clouds, making management easier and reducing complexity.

  3. Use portable abstractions (Kubernetes, Terraform), open standards (PostgreSQL, Kafka), and avoid proprietary services without alternatives.

  4. Massive data attracts workloads because moving data is expensive and slow. It is better to move compute to the data.

  5. Datadog, Grafana Cloud, Prometheus + Thanos, Elastic Stack, New Relic.


Multi-Cloud

CertificationProviderFocus
HashiCorp Terraform AssociateHashiCorpMulti-Cloud IaC
CKA/CKADCNCFKubernetes
AWS Solutions ArchitectAWSAWS Architecture
Azure Solutions ArchitectMicrosoftAzure Architecture
GCP Professional Cloud ArchitectGoogleGCP Architecture
  1. Terraform Associate - IaC foundation
  2. CKA - Kubernetes Administration
  3. 1 cloud certification based on your focus
  4. 2nd cloud certification to diversify

Course summary

Congratulations! You have completed the Multi-Cloud course.

You now have a solid grasp of:

  • Multi-Cloud strategies
  • Terraform for multi-provider infrastructure
  • Multi-cluster Kubernetes with ArgoCD/Istio
  • Cross-cloud networking
  • IAM and secrets
  • Data management
  • Unified monitoring

Next steps

  • Practice with hands-on labs
  • Take the certifications
  • Contribute to open source projects
  • Join communities (CNCF, HashiCorp)

← Back to table of contents