Security Architecture#

Cloud security is fundamentally different from on-premises security. There’s no physical perimeter to defend. Instead, identity becomes the perimeter, encryption becomes the default, and automation replaces manual audit. This section covers the architectural patterns for securing cloud environments without slowing down delivery.


Zero-Trust in the Cloud#

Zero-trust is not a product — it’s an architecture principle: never trust, always verify. Every request is authenticated and authorised, regardless of its origin.

Traditional vs Zero-Trust#

Traditional (Perimeter-Based)             Zero-Trust (Identity-Based)
┌────────────────────────────┐           ┌────────────────────────────┐
│         TRUSTED ZONE       │           │  Every request verified:   │
│                            │           │                            │
│  ┌────┐  ┌────┐  ┌────┐  │           │  ┌────┐  ┌────┐  ┌────┐  │
│  │Svc │──│Svc │──│Svc │  │           │  │Svc │─?│Svc │─?│Svc │  │
│  │ A  │  │ B  │  │ C  │  │           │  │ A  │  │ B  │  │ C  │  │
│  └────┘  └────┘  └────┘  │           │  └────┘  └────┘  └────┘  │
│                            │           │  ? = authn + authz + mTLS │
│  "Inside = trusted"       │           │  "Nothing is trusted"     │
│  (one breach = full access)│           │  (breach is contained)    │
└────────────────────────────┘           └────────────────────────────┘

Zero-Trust Principles#

PrincipleImplementation
Verify explicitlyAuthenticate every request (user, service, device)
Least privilegeGrant minimum permissions needed, with time limits
Assume breachSegment networks, encrypt everything, monitor continuously
No implicit trustInternal network ≠ trusted; treat VPC traffic as potentially hostile
Continuous validationRe-evaluate access decisions based on context (location, device, behaviour)

Identity-Based Perimeter#

In the cloud, the network is no longer the security boundary — identity is. Every request carries an identity, and every resource has a policy.

Identity Architecture#

┌─────────────────────────────────────────────────────────────────┐
│                      Identity Provider (IdP)                     │
│                   (Okta, Entra ID, Google Workspace)             │
└──────────┬──────────────────────────────┬───────────────────────┘
           │ OIDC / SAML                  │ Workload Identity
           ▼                              ▼
┌──────────────────────┐       ┌──────────────────────────────┐
│  Human Access         │       │  Machine/Service Access       │
│                      │       │                              │
│  SSO → Assume Role   │       │  IRSA / Workload Identity    │
│  MFA enforced        │       │  Federation                  │
│  Session: 1 hour     │       │  No long-lived keys          │
│  Audited             │       │  Short-lived tokens           │
└──────────────────────┘       └──────────────────────────────┘

Service-to-Service Authentication#

PatternSecurityComplexityUse When
IAM roles (IRSA, workload identity)HighLowService within same cloud
mTLS (mutual TLS)Very highMediumCross-service, service mesh
API keysLowLowLegacy integration (avoid for new)
OAuth 2.0 client credentialsHighMediumCross-org API access
Short-lived tokens (STS)HighLowTemporary cross-account access

The IAM Decision Hierarchy#

Can you use the cloud provider's identity? (IRSA, workload identity)
├── Yes → Use it. No keys, automatic rotation, audit trail built in.
└── No
    ├── Can you use mTLS? (service mesh, internal services)
    │   └── Yes → Use it. Identity tied to certificate.
    └── No
        ├── Can you use OAuth 2.0 with short-lived tokens?
        │   └── Yes → Use it. Machine-to-machine flow.
        └── Last resort → API key, but:
            ├── Rotate frequently (90 days max)
            ├── Store in secrets manager
            └── Never embed in code or config files

Encryption Patterns#

Encryption at Rest#

ApproachWho Manages KeyKey VisibilityUse Case
Provider-managed (SSE)ProviderNo visibilityDefault for most workloads
Customer-managed key (CMK)You (via KMS)Full control, auditRegulated data, compliance
Client-side encryptionYou (app layer)Full controlMaximum security, zero-trust of provider

Encryption in Transit#

LayerMechanismNotes
External (internet)TLS 1.2+ with managed certificatesACM, Let’s Encrypt, managed SSL
Internal (VPC)TLS between services or mTLS via service meshNot encrypted by default on most clouds
Database connectionsTLS with certificate pinningEnforce sslmode=verify-full
Storage API callsHTTPS (enforced via bucket policy)Deny http:// requests to S3/GCS

Encryption in Use (Confidential Computing)#

Emerging pattern where data is encrypted even while being processed:

TechnologyProviderUse Case
Nitro EnclavesAWSProcessing sensitive data in isolated enclaves
Confidential VMsGCP, AzureMemory encrypted by hardware (SEV-SNP, TDX)
Clean RoomsAWS, SnowflakeMulti-party computation without exposing raw data

Secrets Management#

Secrets (API keys, database passwords, certificates) must never be in code, config files, or environment variables baked into images.

Secrets Architecture#

┌──────────────────────────────────────────────┐
│               Secrets Manager                  │
│         (Vault, AWS SM, GCP SM, AKV)          │
│                                                │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │ DB pass  │  │ API keys │  │ TLS certs│   │
│  │ (auto-   │  │ (rotated │  │ (auto-   │   │
│  │  rotated)│  │  90 days)│  │  renewed)│   │
│  └──────────┘  └──────────┘  └──────────┘   │
└───────────────────────┬──────────────────────┘
                        │ IAM-authenticated request
                        ▼
            ┌──────────────────────┐
            │  Application         │
            │  (fetches at startup │
            │   or via sidecar)    │
            └──────────────────────┘

Secrets Management Rules#

RuleImplementation
No secrets in codePre-commit hooks scan for secrets (gitleaks, truffleHog)
No secrets in CI variablesUse secrets manager, referenced by name
Automatic rotationSecrets Manager rotation Lambda / function
Least privilege accessOnly the consuming service has secretsmanager:GetSecretValue
Audit all accessCloudTrail / audit logs for every GetSecret call
No shared secretsEach service/environment gets its own secret

Compliance Automation#

Manual compliance audits are slow, expensive, and point-in-time. Cloud-native compliance is continuous, automated, and evidence-generating.

Compliance as Code Architecture#

┌─────────────────────────────────────────────────────────────┐
│                   Compliance Pipeline                         │
│                                                               │
│  ┌──────────────┐   ┌────────────────┐   ┌──────────────┐  │
│  │ Policy as     │──►│ Continuous     │──►│ Evidence     │  │
│  │ Code          │   │ Evaluation     │   │ Collection   │  │
│  │               │   │                │   │              │  │
│  │ (OPA, Config  │   │ (Config Rules, │   │ (Automated   │  │
│  │  Rules, Azure │   │  Security Hub, │   │  reports,    │  │
│  │  Policy)      │   │  SCC)          │   │  dashboards) │  │
│  └──────────────┘   └────────────────┘   └──────────────┘  │
│                                                               │
│  Detect → Alert → Auto-remediate (or block)                  │
└─────────────────────────────────────────────────────────────┘

Common Compliance Controls#

ControlImplementationAutomation
Encryption at restDefault encryption on all storageConfig rule: deny unencrypted resources
Logging enabledCloudTrail / audit logs in all accountsSCP: deny disabling CloudTrail
Public access blockedNo public S3 buckets, no public IPs without approvalAccount-level S3 public access block
MFA enforcedSSO with MFA; deny console without MFAIAM policy condition: aws:MultiFactorAuthPresent
Tagging complianceRequired tags on all resourcesConfig rule + auto-tag remediation
Vulnerability scanningContainer image scanning in CI/CDBlock deployment if critical CVEs found

Security as Code#

Security controls should be version-controlled, peer-reviewed, tested, and deployed through the same pipeline as application code.

What Gets Codified#

Security DomainCode Artefact
Network rulesSecurity groups, NACLs (Terraform)
IAM policiesPolicy documents (Terraform/CDK/Bicep)
Encryption configKMS keys, bucket policies (Terraform)
Compliance rulesOPA/Rego policies, Config rules
Incident responseLambda/Cloud Function auto-remediation
Secret rotationRotation Lambda triggered by Secrets Manager
Vulnerability gatesCI/CD pipeline stages (Trivy, Snyk, SonarQube)

Security in the CI/CD Pipeline#

Code Push
    │
    ▼
┌──────────────┐
│ Static Analysis │  ← SAST (SonarQube, Semgrep)
│ Secret Scanning │  ← gitleaks, truffleHog
└──────┬───────┘
       │
       ▼
┌──────────────┐
│ Dependency    │  ← SCA (Snyk, Dependabot, Trivy)
│ Scanning      │     CVE database check
└──────┬───────┘
       │
       ▼
┌──────────────┐
│ Container     │  ← Image scanning (Trivy, ECR scan)
│ Scanning      │     Base image CVEs, misconfigurations
└──────┬───────┘
       │
       ▼
┌──────────────┐
│ IaC Scanning  │  ← tfsec, checkov, cfn-nag
│               │     Misconfigured resources
└──────┬───────┘
       │
       ▼
┌──────────────┐
│ Deploy        │  ← Only if all gates pass
└──────────────┘

Cloud-Native SIEM#

Traditional SIEMs are on-premises appliances designed for network logs. Cloud-native SIEM aggregates and correlates cloud-specific signals.

Signal Sources#

SourceWhat It Captures
Cloud audit logs (CloudTrail, Activity Log)API calls, who did what
VPC flow logsNetwork connections, traffic patterns
DNS query logsResolution attempts (including malicious domains)
Application logsBusiness logic errors, auth failures
Container runtimeProcess execution, file system changes
Identity eventsLogin attempts, MFA failures, privilege escalation
Config changesResource creation, modification, deletion

Detection Architecture#

Signal Sources                  Analysis                     Response
┌───────────────┐              ┌──────────────┐            ┌──────────────┐
│ CloudTrail    │─┐            │              │            │ Alert →      │
│ VPC Flow Logs │─┤            │ Correlation  │            │ Slack/Pager  │
│ DNS Logs      │─┼───────────►│ Engine       │───────────►│              │
│ GuardDuty     │─┤            │ (SIEM /      │            │ Auto-        │
│ App Logs      │─┘            │  Security    │            │ Remediate    │
│               │              │  Lake)       │            │ (Lambda /    │
└───────────────┘              └──────────────┘            │  Step Fn)    │
                                                            └──────────────┘

Key Takeaways#

  • Zero-trust treats every request as untrusted regardless of network origin — identity is the new perimeter
  • Prefer cloud-native workload identity (IRSA, workload identity federation) over long-lived API keys
  • Encrypt at rest by default (provider-managed keys); use customer-managed keys when regulation demands it
  • Centralise secrets in a secrets manager with automatic rotation — never in code, CI variables, or config files
  • Automate compliance with policy-as-code (OPA, Config Rules, Azure Policy) and integrate security scanning into CI/CD
  • Cloud-native SIEM correlates audit logs, flow logs, DNS logs, and identity events to detect threats automatically
  • Security controls are code: version-controlled, peer-reviewed, tested, and deployed through pipelines