Cloud Security Fundamentals: Shared Responsibility Explained

Cloud computing changed how organisations build and run technology, and it changed the security model with it. The provider secures the underlying infrastructure, but you are responsible for how you configure and use it, and most cloud breaches come from customer-side mistakes: open storage buckets, over-permissive roles and leaked keys. This lesson explains the shared responsibility model, the main risks and the controls that matter, with lab exercises you can do inside the free tiers of major providers.

Cloud Service Models and Who Secures What

ModelYou manageProvider managesExamples
IaaS (Infrastructure)Operating system, patches, network rules, applications, data, identitiesPhysical data centres, hardware, virtualisationVirtual machines, virtual networks
PaaS (Platform)Application code, data, identities, configurationOperating system, runtime, platformApp hosting, managed databases
SaaS (Software)Data, user access, configuration and sharing settingsNearly everything elseEmail, office suites, CRM
FaaS / serverlessFunction code, permissions, event configuration, dataServers, scaling, runtime patchingFunctions-as-a-service

This division is the shared responsibility model. A useful rule: the provider is responsible for the security of the cloud; you are responsible for security in the cloud. Deployment models matter too: public, private, hybrid and multi-cloud, each with different risks.

Top Cloud Risks

RiskWhat happensControl
MisconfigurationStorage open to the internet, permissive security groups, unencrypted databasesSecure baselines, policy-as-code, posture management (CSPM)
Weak identity and access managementOver-privileged roles, shared accounts, no MFA, unused usersLeast privilege, MFA, role-based access, regular reviews
Exposed credentials and keysAccess keys in code repositories, images or chatSecrets managers, short-lived credentials, secret scanning
Insecure interfaces and APIsPublic management APIs and weak authenticationPrivate endpoints, strong authentication, rate limits
Data exposureUnclassified, unencrypted, over-shared dataClassification, encryption, access logging, DLP
Lack of visibilityNo audit logs, shadow IT, unknown assetsCentral logging, asset inventory, cloud-native audit trails
Supply-chain and third-party riskVulnerable images, libraries and SaaS integrationsImage scanning, vendor review, signed artefacts
Insecure workloadsUnpatched VMs, containers running as rootHardening, patching, runtime protection

The Core Controls

1. Identity first

  • Protect the root or owner account with strong, unique credentials and hardware-backed MFA; do not use it for daily work.
  • Use roles and groups instead of long-lived user keys. Prefer temporary, automatically rotated credentials.
  • Apply least privilege: start with no access and grant only what is required. Review unused permissions.
  • Use federation and single sign-on where possible; see Identity and Access Management.

2. Network design

  • Place workloads in private subnets; expose only load balancers or gateways that need to be public.
  • Use security groups and network ACLs with deny-by-default.
  • Use private endpoints for provider services so traffic stays off the public internet.
  • Apply segmentation ideas from Firewalls, IDS/IPS and Segmentation.

3. Data protection

  • Encrypt data at rest and in transit by default; manage keys in a key management service, with separation of duties and rotation.
  • Block public access to storage at the account level unless there is an explicit, reviewed need.
  • Enable versioning and immutable backups for critical data.

4. Logging and monitoring

  • Turn on audit logging for all accounts and regions (control-plane and data-plane where relevant) and send them to a protected central location.
  • Alert on risky events: root logins, policy changes, new access keys, disabled logging, public storage changes.
  • Feed cloud logs into your SIEM; see SIEM, Logging and SOC Operations.

5. Governance and automation

  • Define infrastructure as code (Terraform, CloudFormation, Bicep) and scan it before deployment (for example with Checkov or tfsec).
  • Enforce guardrails with organisation-level policies, such as service control policies or Azure Policy.
  • Tag resources with owner, environment and data classification to maintain accountability.

Containers and Kubernetes in Brief

  • Use minimal, regularly scanned base images; pin versions and sign images.
  • Do not run containers as root; drop unneeded capabilities; use read-only file systems where possible.
  • Never bake secrets into images.
  • In Kubernetes: enable role-based access control, restrict the API server, use network policies, enforce pod security standards and protect the etcd datastore.

Practice Lab 1: A Safe Cloud Account Baseline

Create a free-tier account with a major provider, using a separate email address and a spending alert. Then:

  1. Enable MFA on the root or owner account and store recovery codes safely offline.
  2. Create an administrator user or role for daily work, with MFA, and stop using the root account.
  3. Set a billing budget alert so that mistakes or abuse do not generate a surprise bill.
  4. Enable audit logging (for example, an organisation-wide trail) and confirm events appear.
  5. Create a storage bucket, leave public access blocked, and upload a test file. Attempt to read it anonymously from a browser and confirm access is denied.

Write down each setting and why it matters. Delete resources when finished to avoid costs.

Practice Lab 2: Find and Fix Misconfigurations in Code

Create a small infrastructure-as-code file with deliberate mistakes (a Terraform example, for illustration) and scan it:

resource "aws_s3_bucket" "lab" {
  bucket = "my-lab-bucket-example-12345"
}

resource "aws_security_group" "lab" {
  name = "lab-sg"
  ingress {
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]     # open to the world: flagged by scanners
  }
}
pip install checkov
checkov -d .

Review the failed checks. Fix the security group to allow SSH only from your own address and add encryption and public-access-block configuration for the bucket. Rerun until the scan is clean. This is exactly how teams catch problems before deployment.

Practice Lab 3: Containers Locally

docker run --rm -it --read-only --cap-drop ALL --security-opt no-new-privileges alpine:3.20 sh
# Inside: try to write to the root file system and see it fail, check the user with id
trivy image alpine:3.20            # scan the image for known vulnerabilities

Compare the results with running a container without these options. Document each protection you applied.

Cloud Incident Basics

  • Leaked access key: deactivate it immediately, review audit logs for its use, rotate related secrets and look for newly created users, roles or resources.
  • Public storage exposure: block public access, assess access logs to see if data was retrieved, and handle notification duties.
  • Crypto-mining abuse: find and stop unexpected compute, investigate how access was gained and set quotas and alerts.
  • Preserve snapshots and logs before deleting compromised resources; see Incident Response Process and Playbooks.

Common Mistakes

  • Assuming the provider secures everything.
  • Using the root account for routine work or sharing credentials.
  • Committing access keys to repositories.
  • Leaving logging disabled to “save money”.
  • Copying public tutorials that open ports or storage to the whole internet and forgetting to close them.

Practice Exercises

  1. For an email service (SaaS), a virtual machine (IaaS) and a managed database (PaaS), list what you must secure in each case.
  2. Explain why long-lived access keys are riskier than temporary role credentials.
  3. Design an account structure for development, testing and production with separate accounts or subscriptions and explain the security benefits.
  4. List five cloud events that should trigger an immediate alert.
  5. Write a short policy for storage buckets covering public access, encryption, logging and retention.

Mentor tip: In cloud security, identity is the new perimeter. Spend your first hour on a new account on MFA, logging and permissions, and you will prevent most of the incidents that make the headlines.

Educational use only: configure and test only cloud accounts that you own or are authorised to manage, and respect each provider’s acceptable use and penetration testing policies.

Key takeaways
  • The shared responsibility model: the provider secures the cloud; you secure what you put in it.
  • Most breaches stem from misconfiguration, weak identity controls and leaked credentials.
  • Lock down the root account, use roles, least privilege and MFA.
  • Enable logging, encryption and private networking, and scan infrastructure-as-code.
  • Practise in free tiers with budget alerts, and clean up after each lab.

Related Lessons