The previous lesson ended with a suspicion. Several data protection decisions rest on pieces that live in the cloud: the KMS, the secrets store, the delivery photo bucket, the managed databases and cache. We have drawn them as secure boxes, taking for granted that they will be well configured. In the cloud, most incidents are not due to a failure of the provider or to a sophisticated attacker, but to a customer who left something open. And for Rutaverde the cloud is a new environment: finding F-10 says there is no model for accounts or permissions, and no rules that prevent an insecure configuration. In this lesson we will see what the provider protects and what it does not, how identities are managed in the cloud, how accounts and environments are organized, and how guardrails are built so that the most common mistake cannot be made.

Warning. The choice of provider, the regions, and the certifications have contractual and regulatory implications (data protection, ENS (Spain's National Security Framework) if you work with the public sector, industry regulations). They must be reviewed with regulatory compliance professionals and legal counsel. The data in the case is fictitious and the configuration examples are generic, not the syntax of any specific provider.

Contents

  1. The shared responsibility model
  2. Identity and access management in the cloud
  3. Account organization and environment separation
  4. Misconfigurations and posture management
  5. Policy as code and guardrails
  6. Security of managed services
  7. The cloud audit log
  8. Security of the hybrid environment
  9. Container and image security
  10. Data sovereignty and residency
  11. Security criteria for choosing a provider
  12. Design for Rutaverde

  1. The shared responsibility model

When we presented the fundamentals, we saw that protection is shared among several parties. In the cloud that split has a name of its own, the shared responsibility model, and it is summed up in one sentence: the provider is responsible for the security of the cloud; the customer, for security in the cloud.

Where the boundary runs depends on the service model. Recall the three: infrastructure as a service (IaaS), platform as a service (PaaS), and software as a service (SaaS).

Layer In your own data center IaaS PaaS SaaS
Data and its classification Customer Customer Customer Customer
Identities and permissions Customer Customer Customer Customer
Service configuration Customer Customer Customer Customer
Application Customer Customer Customer Provider
Runtime environment and middleware Customer Customer Provider Provider
Operating system and its patches Customer Customer Provider Provider
Virtualization, physical network, and hardware Customer Provider Provider Provider
Facilities: building, power, physical access Customer Provider Provider Provider

The most important reading is that of the first three rows: they always belong to the customer, in every model. No provider decides whom you give access to, what data you upload, or how you configure what you contract.

Applied to Rutaverde's pieces:

Piece Model The provider takes care of Rutaverde takes care of
Tracking and Notifications instances IaaS or PaaS, depending on how they run The infrastructure and, where applicable, the operating system The application, its dependencies, its configuration, and its permissions
db-tracking, cache-tracking, event-bus PaaS The engine, its patches, the replica, and the backups Who has access, from which network, with what encryption, and what data it contains
Object storage, KMS, secrets store PaaS Durability and availability The access policies, without exception
Identity provider; SMS and email provider SaaS The whole platform The users, the roles, the MFA requirement, and the data that is sent
db-01 and the rest of the data center Own Nothing Everything

A managed service reduces the security work, not the responsibility. And it reduces it in precisely the most mechanical part, patches and hardware, which leaves the customer with the part that requires judgment.

  1. Identity and access management in the cloud

In the cloud, everything is done by calling an API: creating a database, opening a port, reading a file, deleting a backup. Whoever controls the identities controls the entire environment. That is why people say that identity is the perimeter of the cloud, and the service that governs it, generically called IAM (Identity and Access Management), is the most important control.

Its basic concepts:

Concept What it is
User A permanent identity, normally a person's
Group A set of users to which permissions are assigned in bulk
Role A set of permissions that a person or a service assumes temporarily; it hands out short-lived credentials
Policy A document that declares which actions are allowed or denied, on which resources, and under what conditions
Workload identity The identity the platform assigns to a machine or service, with no passwords

Four design rules:

  • People: no local users. Employees come in through federation from the corporate identity provider, with its MFA, and assume a role. Offboarding them in one place offboards them everywhere.
  • Services: no long-lived keys. A static access key ends up in a repository, on a laptop, or in a log. Services use their workload identity and receive temporary credentials that expire in minutes or hours.
  • Least privilege in the policies. Specific actions on specific resources. Wildcards in both fields at once are, in practice, administrator permissions.
  • The root account is not used. The identity with which the account was created can do anything and cannot be restricted. It is protected with physical MFA, locked away, and used only in the handful of operations that require it.

Let's look at a policy. The syntax is generic, inspired by the one several providers use:

{
  "version": "2026-07",
  "statements": [
    {
      "id": "ReadAndWriteDeliveryPhotos",
      "effect": "Allow",
      "actions": ["object:Read", "object:Write"],
      "resources": ["storage:rv-delivery-photos/*"],
      "conditions": {
        "encrypted_transport": true,
        "source_network": ["rutaverde-private-network"]
      }
    },
    {
      "id": "UseThePhotosKey",
      "effect": "Allow",
      "actions": ["kms:GenerateDataKey", "kms:Decrypt"],
      "resources": ["kms:key-photos"]
    }
  ]
}

Explanation, piece by piece:

  • statements is a list; each element grants or denies a set of actions.
  • effect is either Allow or Deny. Everything that is not expressly allowed is denied: that is deny by default. When there is a conflict, an explicit deny always wins.
  • actions lists specific operations. This policy allows reading and writing objects, but not deleting them, listing the bucket, or changing its configuration.
  • resources limits where: only the objects in rv-delivery-photos. It is not valid for any other bucket.
  • conditions adds context requirements: the connection must be encrypted and come from Rutaverde's private network. Stolen credentials used from somewhere else would be useless.
  • The second statement allows using the key-photos key to encrypt and decrypt, but not administering it. This is the separation of duties we saw in key management.

This policy is attached to the monolith's role. The Tracking service, which does not handle photos, does not have it.

  1. Account organization and environment separation

Providers let you group resources into isolated compartments, which depending on the provider are called accounts, subscriptions, or projects. Here we will call them accounts. An account is the strongest isolation boundary the cloud offers: what is in one cannot see what is in another unless it is expressly authorized.

Putting everything in a single account is the cloud equivalent of the flat network: any mistake has total reach. Splitting into several accounts provides:

  • Damage containment (blast radius): a credential compromised in pre-production does not touch production.
  • Simpler permissions: access is granted to a whole account instead of being fine-tuned resource by resource.
  • Different rules per environment: more freedom where people experiment, more rigor where the data is.
  • Costs separated by nature, which will be useful when we talk about cost management.

Accounts are grouped into an organization, from which policies are applied that no account can bypass. These are the guardrails, which we will see shortly.

On environments: production and pre-production must be separated by account, by network, by credentials, and by data. Pre-production tends to be the weak link, because more people use it and with fewer controls; that is why we decided it would run on synthetic data.

  1. Misconfigurations and posture management

The most frequent cause of incidents in the cloud is misconfiguration. The cases repeat with monotony:

Typical mistake Consequence
Object storage bucket with public access Anyone downloads its contents
Database or cache with a public address and a port open to the Internet Exposed to access attempts from all over the world
Administration port open to 0.0.0.0/0 Continuous automated attacks
Role or policy with administrator permissions "to make it work" A compromised credential can do anything
Static access keys in a repository Third-party access to the account
Unencrypted stores or disks Non-compliance with NFR-09
Audit log disabled Impossible to know what happened
Forgotten test resources Attack surface and cost with no owner

Why do they happen? Because creating resources is extremely easy, because there are hundreds of services with thousands of options, and because opening up a permission is the fastest way to get something working on a Friday afternoon. It is not a problem of careless people, but of an environment where the mistake is one click away. The architectural answer is not to ask for more care, but to build an environment where the mistake is hard to make and easy to detect.

Detection has a name: cloud security posture management (CSPM). It is a category of tools that continuously review the configuration of all resources, compare it with a set of rules, and flag deviations. It is a detective control. Its preventive complement is guardrails.

  1. Policy as code and guardrails

A guardrail is a rule that prevents, or instantly detects, an insecure configuration, no matter who attempts it or with what permissions. The image is that of a mountain road: the guardrail does not drive for you or tell you where to go, but it keeps you from going over the edge.

There are two types:

  • Preventive: the operation is rejected. They are applied from the organization, above the permissions of each account.
  • Detective: the operation goes through, but it generates a finding or is automatically reverted.

Guardrails are written as policy as code: rules in text files, stored in a repository, reviewed by another person before being applied, and evaluated automatically. They have the advantages of everything that is code: history, review, and repeatability. Here is an example in a generic notation:

guardrails:
  - id: B-01
    name: European Union regions only
    type: preventive
    rule: deny any operation outside the allowed regions
    allowed_regions: [eu-south-a, eu-west-a]
  - id: B-02
    name: Object storage never public
    type: preventive
    rule: deny changes that enable public access on a bucket
  - id: B-03
    name: Encryption at rest mandatory
    type: preventive
    rule: deny the creation of unencrypted stores, disks, or databases
  - id: B-07
    name: No inbound access open to the Internet
    type: detective
    rule: flag any network rule with source 0.0.0.0/0
    exceptions: [tracking-load-balancer port 443]
    action: revert and notify security
  • Each guardrail has a stable id, so it can be cited in decisions and findings.
  • type indicates whether it prevents or detects.
  • rule describes the condition; in a real tool it would be an evaluable expression.
  • allowed_regions uses fictitious region names; what matters is that the list is closed.
  • exceptions puts the legitimate cases on record. A written, reviewed exception is acceptable; an exception made by hand in the console is not.
  • action, in detective guardrails, says what happens when one is triggered.

The same rules can be evaluated at two moments: before the infrastructure is created, on its definition, and afterward, on what is deployed. Automating those checks within the deployment process is studied in Module 4.

  1. Security of managed services

For each managed service, the architect asks the same five questions: where it is reachable from, who can access it, how it is encrypted, what gets logged, and what happens with the backups. Applied to the ones Rutaverde uses:

Service Network access Identity Encryption Other measures
Object storage Public access fully blocked; access from the private network through a private endpoint Policy per bucket and per role At rest with a KMS key; TLS only Versioning; lifecycle rules; 5-min signed URLs for the photos
db-tracking No public address; only from the application subnets svc-tracking user; administration with personal accounts At rest and mandatory TLS Encrypted automatic backups; deletion protection
cache-tracking No public address Authentication enabled; service user At rest and TLS No direct personal data, by design
event-bus No public address; reachable from the cloud and, over the link, from the monolith One user per service, with per-queue permissions TLS; at rest No personal data in the events
KMS and secrets-store Private endpoint Administration separated from use Built into the service Logging of every use; key deletion protection

The case of static files deserves a note. It might seem that the bucket serving the website's files must be public. It does not have to be: the bucket is private and only the CDN has permission to read it. That way there is no exception to guardrail B-02, and nobody can bypass the CDN.

  1. The cloud audit log

All providers offer an audit log of the control plane: who made which call, when, from where, and with what result. It is the fundamental detective control and the basis of any investigation. To be of use, it must meet four conditions:

  • Enabled in all accounts and regions, including the ones that are not used: that is where nobody is looking.
  • Centralized in a separate account, which the administrators of the other accounts cannot access to modify anything.
  • Immutable during its retention period: whoever compromises an account tries to erase their tracks.
  • Protected against being disabled with a guardrail.

Besides the control plane, access to the data of the most sensitive resources can also be logged, such as reads of the photo bucket or use of the keys. Turning those logs into alerts and incident response is a matter for monitoring, in Module 4.

  1. Security of the hybrid environment

Rutaverde is not in the cloud: it is in a data center and in the cloud. A hybrid environment has the risks of both and one of its own: that the weaker of the two serves as a door into the other.

On the division of responsibilities, three points:

  • A single source of identities. The same identity provider governs access to the data center and to the cloud. Two separate directories end up out of sync, and offboarding is left half done.
  • Data center workloads also need an identity in the cloud. The monolith publishes events and uploads photos and backups. It must not do so with a static key kept in a file: it assumes a role through federation and receives temporary credentials.
  • The link is a shared responsibility. The carrier and the provider answer for the circuit; Rutaverde answers for what traffic it lets through and for that traffic being encrypted. A private link is not a trusted zone: it joins two networks, and whatever compromises one can reach the other if it is not filtered. The design of that filtering belongs to the next lesson.

  1. Container and image security

Cloud services are deployed from images: virtual machine or container images. Which one is used for Tracking and Notifications is a platform decision that will be made when we cover automation; the security rules are the same in both cases and are worth setting now, from a bird's-eye view:

Phase Measure
Build Minimal base image of known origin; dependencies pinned to specific versions
Analysis Vulnerability scanning of the image and its dependencies before publishing it
Storage Private image registry, image-registry; signed images
Deployment Only signed images from the company's own registry are run
Runtime No administrator privileges; read-only file system where possible; no secrets inside the image
Maintenance Instances are immutable: they are not patched, they are replaced with a new image

The underlying idea is that of the supply chain: what runs in production includes a great deal of code Rutaverde did not write. Knowing what each image contains and where it comes from is part of security.

  1. Data sovereignty and residency

Three closely related concepts that should not be mixed up:

Concept Question
Residency In what physical place is the data stored and processed?
Sovereignty To which jurisdiction's laws are the data and the provider holding it subject?
Localization Does any regulation require that certain data not leave a territory?

Residency is decided by the customer when choosing the region. Sovereignty is subtler: data stored in the European Union may be held by a provider that is also subject to another country's laws. It is a legal and contractual question beyond the architect's remit, but one the architect must be aware of in order to ask the right questions.

What is in the architect's hands:

  • Choosing the regions and enforcing the choice with a guardrail, not with a note in a document.
  • Checking where the backups, the logs, the metadata, and the provider's technical support are hosted as well.
  • Using customer-managed keys, which add control over who can decrypt.
  • Asking the SaaS providers the same questions: identity, SMS and email, maps.

  1. Security criteria for choosing a provider

ADR-002 left the cloud provider unchosen. Security contributes criteria to that choice, and the first thing people usually look at is certifications: statements, audited by a third party, that the provider meets a set of requirements.

Certification or framework What it is
ISO/IEC 27001 International standard certifying that the organization has an information security management system
ENS (Esquema Nacional de Seguridad) Spanish framework of security requirements, mandatory for the public sector and its suppliers; it has basic, medium, and high levels
SOC 2 An independent auditor's report on a service organization's controls for security, availability, and confidentiality, among other criteria

Two caveats. A certification has a scope: you have to check that it covers the services and regions you are going to use. And it certifies the provider, not the customer: using a certified cloud does not make what is deployed on it secure. It is, once again, shared responsibility.

Beyond certifications, the criteria Clara will bring into the evaluation: regions in the European Union with at least two zones; an IAM with roles, temporary credentials, and federation; the ability to apply guardrails from the organization; customer-managed keys; a complete, immutable audit log; private endpoints for the managed services; and contractual terms suitable for the processing of personal data.

  1. Design for Rutaverde

Account structure

Five accounts inside one organization, and no more for now (P3):

flowchart TB
    ORG["Rutaverde organization: guardrails B-01 to B-08"]
    ORG --> SEC["rv-security: audit logs and posture review"]
    ORG --> NET["rv-network: link to the data center and shared network"]
    ORG --> PROD["rv-prod: Tracking, Notifications, and their managed services"]
    ORG --> PRE["rv-preprod: scaled-down replica, with synthetic data"]
    ORG --> BAK["rv-backups: backups of db-01 and event archive"]
Account Contains Who has access
rv-security rv-audit-logs, posture review tool Security team; nobody else
rv-network Endpoint of the private link and of the backup VPN, shared network Network operations
rv-prod Tracking, Notifications, db-tracking, cache-tracking, event-bus, rv-delivery-photos, rv-static, KMS, secrets-store Operations, with read access by default
rv-preprod The same, at reduced scale and with synthetic data Development and operations
rv-backups rv-db-backups, rv-event-archive Only the backup process writes; nobody deletes

The separation of rv-backups responds to a specific threat: whoever compromises production must not be able to destroy the backups as well. The backup strategy and its recovery are developed in Module 4.

Roles

People always come in through the identity provider and assume a role; there are no local users at all.

Role For whom Permissions Conditions
role-readonly Development and operations View configuration and metrics; not view data By default in all accounts
role-operator Operations Operate the services: restart, scale MFA; does not change permissions or networks
role-platform-admin Two on-call people Administration of one account On request, with another person's approval, 4 hours at most, session recorded
role-security-auditor Security team Read access to configuration and audit logs in all accounts No ability to change anything
role-cost Finance and operations Read access to consumption and billing No access to resources
role-deploy The automated deployment process Create and modify the resources defined as code Only from the deployment system
role-svc-tracking Tracking instances Its secrets, its database, its cache, and its queue Workload identity
role-svc-notifications Notifications instances Its secrets and its queue Workload identity
role-svc-monolith Data center instances Publish events, read and write photos, use key-photos and key-shipment-fields Federation; 1-hour credentials
role-backup Data center backup process Only write to rv-db-backups and rv-event-archive Cannot read or delete

Day to day, nobody has administration permissions: they are obtained when they are needed and expire by themselves.

Guardrails

Id Guardrail Type
B-01 Only European Union regions can be used Preventive
B-02 No object storage bucket can be public Preventive
B-03 Every store, disk, and database is created encrypted Preventive
B-04 Databases, caches, and the bus have no public address Preventive
B-05 The audit log cannot be disabled or modified Preventive
B-06 No local users or long-lived access keys are created Preventive
B-07 No network rule allows inbound traffic from 0.0.0.0/0, except port 443 on the Tracking load balancer Detective, with automatic revert
B-08 Every resource carries the tags environment, service, owner, and classification Detective

Continuous posture review complements the guardrails: critical findings are fixed within 24 hours and high ones within 7 days. The audit log is kept for 13 months, a period that is also pending validation.

The decision, recorded

# ADR-011: Organization of accounts, identities, and guardrails in the cloud

Status: Accepted
Date: 2026-07-16
Participants: Clara (security), Íñigo (operations), Marta (architecture)

## Context
Finding F-10: the cloud is a new environment with no model for
accounts, permissions, or rules. ADR-002 places the new services and
the backups there and, according to ADR-010, the photos, the keys, and
the secrets.

## Options considered
A. A single account, with permissions fine-tuned resource by resource.
B. Several accounts by function and environment, with guardrails from the organization.
C. One account per service and environment.

## Decision
We will adopt option B. Five accounts: rv-security, rv-network,
rv-prod, rv-preprod, and rv-backups. People gain access only through
federation with the identity provider and assume roles; administration
is temporary, with approval and a maximum of 4 hours. Services use
workload identities, with no long-lived keys. Eight guardrails, B-01
to B-08, defined as code. Managed services with no public exposure
and encrypted. Centralized, immutable audit log in rv-security.
Continuous posture review.

## Consequences
Positive: F-10 is closed; the damage of an incident is contained
within one account; the most serious misconfigurations cannot be made.
Negative: more accounts to administer; administration access is slower
because of the approval.
Risks: option C will be reconsidered if the number of services grows.
These criteria are incorporated into the provider choice of ADR-002.

Common Mistakes and Tips

  • Believing the cloud is secure all by itself. The provider protects its infrastructure. Your configuration, your identities, and your data are yours in every service model.
  • Carrying over the data center model without adapting it. In the cloud, the main control is not the network, but identity.
  • A single account for everything. Any mistake has total reach.
  • Broad permissions "for now." The temporary stays. Start with the minimum and broaden with a reason.
  • Static access keys for services. Use workload identities and temporary credentials.
  • Detective-only guardrails. If something serious can be prevented, prevent it.
  • Exceptions made by hand. A legitimate exception is written into the policy and reviewed.
  • Auditing in the same account that is being audited. Whoever compromises the account will delete it.
  • Confusing the provider's certification with your own security. The certification covers their part.
  • Forgetting pre-production. With real data and fewer controls, it is the easiest target.
  • Tip: for every new resource, answer five questions in writing: where it is reachable from, who can access it, how it is encrypted, what gets logged, and what happens with its backups.

Exercises

Exercise 1

For each situation, state whether the responsibility lies with the cloud provider or with Rutaverde, and why:

  1. The db-tracking engine has a known vulnerability that requires a patch.
  2. The rv-delivery-photos bucket becomes publicly accessible after a change.
  3. A physical disk fails in the zone A data center.
  4. A library used by the Notifications service has a vulnerability.
  5. A former employee still has access to the cloud console three weeks after leaving.

Exercise 2

Review this policy, assigned to the Tracking service's role, and point out all its problems. Then rewrite it.

{
  "statements": [
    {
      "effect": "Allow",
      "actions": ["object:*", "kms:*"],
      "resources": ["*"]
    }
  ]
}

Exercise 3

A developer needs to debug a Tracking problem that only reproduces in production. They ask for "administrator access to rv-prod for this week." With the design from the lesson, what are they granted, and how? Which guardrails would keep protecting the environment even if they made a mistake?

Solutions

Solution 1

  1. Provider. It is a managed service (PaaS): the engine and its patches are theirs. At most, it is up to Rutaverde to choose the maintenance window.
  2. Rutaverde. Service configuration always belongs to the customer. With guardrail B-02, moreover, the change would have been rejected.
  3. Provider. The hardware is theirs in every model. Rutaverde's part is to have deployed across two zones.
  4. Rutaverde. The application and its dependencies belong to the customer in IaaS and in PaaS.
  5. Rutaverde. Identities always belong to the customer. With federation from the identity provider and no local users (B-06), the offboarding would have taken effect the same day.

Solution 2

Problems:

  • object:* allows every operation on objects, including deleting and changing permissions.
  • kms:* allows administering keys, not just using them: it breaks separation of duties and would even allow scheduling the destruction of a key.
  • resources: ["*"] extends the above to every bucket and every key in the account, including the photos.
  • There are no transport or source conditions.
  • The underlying problem: Tracking does not need object storage. It does not handle photos or files.

Rewrite: what Tracking needs is to read its secrets and use the key for its services.

{
  "statements": [
    {
      "id": "ReadItsSecrets",
      "effect": "Allow",
      "actions": ["secrets:Read"],
      "resources": ["secret:prod/tracking/*"]
    },
    {
      "id": "UseTheKeyForItsServices",
      "effect": "Allow",
      "actions": ["kms:Decrypt"],
      "resources": ["kms:key-cloud-services"]
    }
  ]
}

Access to db-tracking, to the cache, and to its queue is granted with the svc-tracking user of each service, as defined when we designed identity. The lesson of the exercise is that least privilege starts by asking what the service needs, not by trimming a broad policy.

Solution 3

They are not granted what they ask for. They are granted what they need:

  1. By default they already have role-readonly in rv-prod: they can see configuration and metrics. That is often enough, together with the logs, which contain no personal data.
  2. If they need to act, one of the on-call people does it with role-operator, or role-platform-admin is requested: with another person's approval, 4 hours at most, and the session recorded. If more time is needed, it is requested again. A week of permanent administration is exactly what the design wants to avoid.
  3. Better still: reproduce the problem in rv-preprod, and if that is not possible, note it down as a shortcoming of that environment.

Even if they obtained the role and made a mistake, the preventive guardrails, which sit above any role in the account, would still be at work: they could not create resources outside the EU (B-01), make a bucket public (B-02), create unencrypted stores (B-03), give the database a public address (B-04), or disable auditing (B-05). And their actions would be recorded in rv-security, out of their reach.

Conclusion

In the cloud, security is shared: the provider protects the infrastructure, and the customer, in every service model, its data, its identities, and its configuration. Identity is the perimeter: people come in through federation and assume roles, services use workload identities, and nobody handles long-lived keys. Splitting the environment into several accounts bounds the damage of any incident. Since most incidents are born of misconfigurations, the environment is designed so that they cannot be made (preventive guardrails, written as code) and so that the ones that slip through are detected right away (continuous posture review and a centralized, immutable audit log). Managed services are used encrypted and with no public exposure; images, signed and from the company's own registry; and data residency is imposed with a rule, not with an intention.

With ADR-011, Rutaverde closes finding F-10: five accounts, ten roles with no standing privileges, and eight guardrails. We have repeated that identity is the perimeter of the cloud and that a private link is not a trusted zone. Both statements point to the same thing: the idea of an internal network in which everything can be trusted no longer describes the platform. What remains to be decided, then, is how the network is organized, what can talk to what in the data center and in the cloud, and what protects the entry point from the Internet. That is the subject of the next lesson, along with the model that replaces trust in the perimeter: zero trust.

© Copyright 2026. All rights reserved