Chapter 16 · Systems & services
Cloud Services & Integration
A 16-lesson research-based field guide to AWS, Azure, Google Cloud, API connectors, OAuth, webhooks, queues, CI/CD, reliability, costs and a calendar–CRM lab.
Cloud integration is the engineering of trustworthy connections between services: define the contract, protect permissions, expect failures and prove the actual business result. Research sources are linked alongside each lesson. Examples and checklists are educational; production deployment requires separate review.
What a cloud integration actually is
An integration is a managed contract across independent systems: each has its own data, availability, security boundary and change schedule. Contrast SaaS APIs with infrastructure, managed application hosting and serverless functions. Record who operates every component and where data lives.
Responsibility is divided between providers and your application. A cloud-hosted process does not automatically gain backups, confidentiality or high availability.
A small CRM hosted on managed infrastructure imports calendar bookings from a third-party SaaS provider; the CRM still owns authorization, matching and retry logic.
Hands-on exercise · reveal the verification check
Map browser, API, database and SaaS provider ownership, then mark three potential failure boundaries.
Your map names a source of truth, customer-data store, token owner and recovery owner.
AWS, Azure, Google Cloud and smaller PaaS platforms
Compare service breadth, team expertise, geographic residency, operating burden, migration friction, pricing model and vendor constraints before choosing a platform. AWS has a wide managed ecosystem; Azure emphasizes enterprise workflows and Entra; Google Cloud supports managed compute and data; specialist PaaS can reduce overhead.
The best cloud is the one the team can secure and operate for a measured cost, not the provider with the longest service catalogue.
A small static site with a Node API can often start on PaaS, whereas a complex enterprise integration may need managed event buses, API management and isolation.
Hands-on exercise · reveal the verification check
Build a decision matrix for two workloads with explicit regions, costs and reliability targets.
Your recommendation describes team skills, service dependencies, costs and an exit plan.
Integration inventory and source of truth
Create an inventory with provider, owner, environment, endpoint, authentication, fields, data classification, region, quota, expected update frequency, failure consequences and support contact. Choose the system of record for each data entity.
Without an inventory, integrations silently become unowned data pipelines with duplicated customers and conflicting records.
A calendar owns meeting start/end times; the CRM owns its customer associations. An adapter keeps both identifiers.
Hands-on exercise · reveal the verification check
Document a calendar–CRM integration register with five sample fields and a field-ownership rule.
Each field has one system of record and a documented conflict strategy.
APIs, HTTP and stable contracts
Define OpenAPI contracts, endpoints, JSON schemas, pagination, authentication, idempotency rules, errors, rate limits and version evolution. Validate outgoing and incoming data instead of assuming a remote API is trustworthy.
Well-defined contracts prevent provider changes from spreading unpredictable errors across a product.
An adapter normalizes a vendor's `event_start` into the application's `startsAt` ISO timestamp.
Hands-on exercise · reveal the verification check
Draft a GET events endpoint with cursor pagination and 400, 401, 429 and 503 responses.
A consumer knows exactly what to retry, what to fix and what to show to a user.
OAuth, delegated access and service identity
For user-granted SaaS connections, use the authorization-code flow with PKCE and narrowly scoped permissions. Validate state, exact redirect destinations and token audience. For server-to-server deployment use short-lived workload identity when the provider supports it.
Tokens grant capabilities, and a stolen token can bypass an otherwise secure interface.
A calendar-connection button redirects to provider consent; only the backend exchanges and stores sensitive tokens.
Hands-on exercise · reveal the verification check
Draw the OAuth flow and label every token-bearing hop.
Your flow uses PKCE, state, secure token handling and revocation on disconnect.
Secrets, privacy, tenants and data residency
Keep credentials server-side in a secrets manager or scoped environment; never commit .env files or expose tokens in HTML. Encrypt sensitive storage, authorize by tenant on every query, minimize retained personal data, and verify legal/regional obligations.
The boundary between two customers is an authorization rule, not simply a UI filter.
Each CRM tenant's calendar connection is bound to a verified tenant ID, with audit records and a disconnect function.
Hands-on exercise · reveal the verification check
Review an imaginary integration log and remove five examples of sensitive content.
Logs retain correlation IDs and error categories but no raw provider token or personal schedule.
Synchronous calls, timeouts and resilience
Synchronous REST is useful when the user needs an immediate result. Bound connection and overall timeouts, use cancellation, handle errors, respect provider rate limits, and retry only safe/idempotent operations with bounded exponential backoff and jitter.
An unhealthy provider should not consume every available application connection or freeze the user interface.
An API fetches current appointment availability and, on timeout, offers a clear temporary failure state rather than a false empty result.
Hands-on exercise · reveal the verification check
Write a 3-second timeout policy and state which HTTP codes trigger retries.
The policy limits attempts and total time and keeps 401/403 as actionable errors.
Events and signed webhooks
Treat webhook input as untrusted. Verify the provider's exact signature algorithm and request body, check timestamp/replay protection if specified, acknowledge quickly after durable receipt, and move processing to a background worker.
Notifications may arrive twice, out of order, or not at all; webhook handlers are not a transaction log.
A calendar provider sends an event-changed notification; intake verifies it, enqueues the ID and returns success.
Hands-on exercise · reveal the verification check
Design a duplicated-event test plus a forged-signature negative test.
Only the valid event enters the durable queue and one final business update occurs.
Queues, dead letters and idempotency
Use durable messages to separate receiving events from processing them. Expect at-least-once delivery; use stable dedupe keys, transactional database upserts, retry classification, visibility timeouts and dead-letter queues.
Decoupling reduces outage blast radius, but a queue alone does not guarantee exactly-once effects.
A booking processor stores `(tenant_id, provider_event_id, version)` and prevents duplicate inserts.
Hands-on exercise · reveal the verification check
Simulate a worker crash after write but before acknowledgement.
Replay leaves one business record and a traceable processing attempt.
Polling, imports, reconciliation and ETL
When webhooks are unavailable, schedule bounded polling with provider cursors or change tokens. Backfill in batches, checkpoint only after commit, and run periodic reconciliation even with webhooks.
Missed notifications and transient network failures eventually create silent data drift.
A nightly CRM import queries changed records since the last confirmed cursor, then reconciles deletions.
Hands-on exercise · reveal the verification check
Stop a mock import halfway through page three and restart it.
No rows are lost or duplicated; a reconciliation report explains differences.
Managed databases, object stores and backups
Choose data stores by transaction needs, query patterns and consistency requirements. Separate backup retention from restore capability; measure recovery time (RTO) and allowable data loss (RPO). Use database migrations and retention policies.
A running replica is not a backup, and a backup is not useful until restoration is demonstrated.
The integration service uses PostgreSQL for booking state and object storage for export archives.
Hands-on exercise · reveal the verification check
Write a restore drill for the integration database with a target RTO and RPO.
Restore produces verified records and a documented elapsed recovery time.
Containers, serverless, Infrastructure as Code and CI/CD
Deploy immutable artifacts; keep staging isolated; version infrastructure and configuration; use protected release environments and federated OIDC identity rather than long-lived cloud keys where supported. Design additive database migrations for rollback compatibility.
A green build is not proof the correct artifact is running or that schema changes can be undone.
A feature branch triggers tests, deploys to isolated staging, verifies a served commit SHA and awaits production approval.
Hands-on exercise · reveal the verification check
Write a promotion checklist from commit through live HTTP and browser verification.
Each gate records evidence, approval and a safe rollback procedure.
Logging, traces, SLOs and incident response
Track successful sync ratio, event lag, queue age, worker failures, token-expiry warnings, provider latency and cost. Correlate logs/traces with request IDs; publish a runbook covering outage, reconnect, replay and incident communication.
Without observability, successful HTTP responses can hide missing business records for days.
An admin screen shows last successful calendar sync, pending queue count and actionable reconnect error.
Hands-on exercise · reveal the verification check
Define three operational alerts and one failure runbook for calendar synchronization.
Alerts have thresholds, ownership and steps to confirm restored business outcomes.
FinOps, quotas, vendor lock-in and scaling
Estimate requests, jobs, compute, storage, egress, backups, observability and third-party API charges. Add budgets, alerts and usage controls. Prefer provider-neutral domain models and clean adapter boundaries; do not abstract away every useful managed feature.
Per-request pricing makes traffic spikes and retry storms a financial as well as reliability risk.
A small scheduling app models low/normal/high webhook events and queue processing volume before purchase.
Hands-on exercise · reveal the verification check
Calculate a symbolic low/normal/high cost model using actual provider price calculators.
The budget has a measured traffic assumption, an alert threshold and a kill switch for runaway jobs.
Accessibility, governance and vendor assessment
Treat integrated admin panels as user interfaces: semantic controls, keyboard support, visible focus, informative status/error announcements, accessible charts and usable consent/reconnect journeys. Review vendor terms, incident support and data handling.
A perfectly connected backend is not useful if operators cannot diagnose or remediate problems.
A disconnected calendar announces its status and offers an operable 'Reconnect calendar' action without relying on colour.
Hands-on exercise · reveal the verification check
Audit a sync dashboard with keyboard only and screen reader before release.
Errors, progress, confirmation and retry actions are accessible and accurately represented.
Capstone lab: calendar–CRM integration from start to finish
Build a small vertical slice: approved consent, token storage, event query, signed webhook intake, queue, idempotent worker, database, reconciliation, admin status, metrics and recovery runbook. Use synthetic data in staging; mark demos as demos.
This lab connects architecture, security, accessibility, reliability and operations into an observable real workflow.
Connect a sample tenant's calendar to a CRM schedule and replay notifications while observing one durable appointment state.
Hands-on exercise · reveal the verification check
Test five cases: normal update, duplicate, bad signature, 429 retry, revoked consent; then demonstrate restore.
Each test has clear evidence; the staging SHA and UI are verified before a separate production approval.