Cloud security best practices are the set of controls and habits that keep a cloud environment resilient against the ways it actually gets breached: over-permissioned identities, exposed services, unencrypted data, and gaps in logging. Pwned Labs teaches these controls, and the attacks they are designed to stop, through hands-on labs in live cloud environments. They apply across AWS, Azure, and Google Cloud, and they matter most at the identity layer, because that is where the majority of documented cloud intrusions begin. This guide walks through the practices that reduce risk the most, in the order they pay off.
What are cloud security best practices?
Cloud security best practices are proven, repeatable controls for protecting cloud infrastructure, data, and identities. They are not a single product or a one-time audit. They are an ongoing discipline that spans identity and access management, network architecture, data protection, configuration hardening, and continuous monitoring. The cloud shifts the work: the provider secures the underlying infrastructure, and you are responsible for how you configure and use it. This split is the shared responsibility model, and most breaches happen on the customer side of that line. The practices below are ordered by impact, because effort spent on identity returns far more than the same effort spent elsewhere.
Start with identity: least privilege and no long-lived credentials
Identity is the perimeter in the cloud, and misconfigured access is the most common root cause of cloud breaches. The goal is simple to state and hard to sustain: every identity should hold only the permissions it actually uses, and there should be no long-lived secrets waiting to be stolen. In practice that means scoping roles tightly rather than attaching broad managed policies, replacing static access keys with short-lived, workload-scoped identities such as IAM roles on AWS, managed identities on Azure, and Workload Identity on Google Cloud, and enforcing multi-factor authentication on every human account. Review permissions continuously with the native tools, including AWS IAM Access Analyzer, Microsoft Entra ID access reviews, and GCP IAM Recommender, and remove the standing access that privilege escalation paths depend on. Just-in-time elevation for administrative actions keeps powerful permissions out of reach until they are needed and audited.
Segment the network and assume breach
A flat network is an attacker's playground. Network controls will not stop an adversary who already holds valid credentials, but they limit exposure and contain blast radius when something does go wrong. Design for segmentation from the start: isolate workloads into separate VPCs or virtual networks, use security groups and network security groups as tight allow-lists, and prefer private endpoints over public ones for managed services. Restrict outbound traffic as deliberately as inbound, since egress control is what stops a compromised workload from exfiltrating data or reaching a cloud metadata endpoint. A zero-trust posture, where every request is authenticated and authorized regardless of network location, is the target state, and flow logs give you the visibility to enforce and verify it.
Protect data with encryption and resilient backups
Encrypt data at rest and in transit everywhere, using provider-managed keys by default and customer-managed keys where you need control over rotation and access. Encryption is table stakes, but it does not protect against an attacker with valid credentials, so pair it with strict access policies on the data stores themselves. Turn off public access on object storage unless a bucket is deliberately meant to be public, and audit for it continuously. The practice that saves organizations during a ransomware or destructive event is resilient backups: keep copies outside the blast radius of the environment they protect, with separate credentials and, ideally, immutability enabled so an attacker who compromises the primary account cannot delete them.
Log everything that matters and detect early
You cannot protect or investigate what you cannot see. Enable control plane audit logging across every account and region, using AWS CloudTrail, Azure Monitor and Entra ID sign-in logs, and Google Cloud Audit Logs, and turn on data plane logging for anything holding sensitive information. Object-level access logging is off by default on every major provider, and its absence is the most common reason an investigation cannot answer what was taken. Centralize logs into a SIEM such as Microsoft Sentinel, Splunk, or Elastic, build detection rules for known cloud attack patterns like anomalous API calls and new credential creation, and rehearse the response so alerts turn into action. The provider security services, including AWS GuardDuty and Security Hub, Microsoft Defender for Cloud, and Google Security Command Center, give you a strong detection baseline to build on.
Harden configurations and enforce guardrails as code
Misconfiguration is the quiet, recurring cause of cloud incidents, and manual review does not scale to hundreds of accounts. Codify your guardrails instead. Policy-as-code tools such as AWS Config rules, Azure Policy, and GCP Organization Policy constraints enforce standards automatically and flag drift the moment it happens. Measure against a recognized baseline like the CIS Benchmarks, and use cloud security posture management to keep that baseline continuously verified rather than checked once a quarter. Building these checks into CI/CD, so an insecure configuration fails the pipeline before it ever reaches production, is what turns hardening from a cleanup task into a default.
Govern for compliance without slowing delivery
Governance ties the technical controls to organizational accountability. Mature programs operating across AWS, Azure, and Google Cloud navigate frameworks such as SOC 2, ISO 27001, PCI DSS, and HIPAA, and the way to do that without grinding delivery to a halt is to make compliance continuous rather than episodic. Map your controls to the frameworks you answer to, monitor them with the native compliance dashboards, and use consistent tagging and resource hierarchies to enforce ownership, cost allocation, and access boundaries at scale. Document the shared responsibility split clearly so both provider and customer obligations are unambiguous when an auditor asks.
Insecure defaults worth changing first
Every major cloud ships defaults that favor a fast start and leave the hardening to you, and a few are worth changing on day one. On AWS, a new IAM user has no MFA requirement and accepts a weak password until you set a policy, IMDSv1 can still be enabled even though new instance launches now default to IMDSv2, and the account that owns an S3 bucket can be confirmed from outside through the s3:ResourceAccount condition key, so a single public bucket is often enough to begin mapping an account. On Microsoft Entra ID, the built-in banned-password protection blocks common English passwords by default and little else, so a password like Velkommen1 passes, and MFA is easy to leave uneven across the many first-party clients that can request a token. On Google Cloud, every Workspace user can create projects by default, service account keys do not expire once issued, and permission probing through testIamPermissions is not written to Cloud Audit Logs for many services, so reconnaissance can run quietly. None of these is a flaw in the provider. Each is a default that assumes we will tighten it, and the fix is to change it rather than wait for an incident to surface it. We go through the full set, with the fix and the detection for each, in insecure defaults in AWS, Azure, and Google Cloud.
How the core controls map across AWS, Azure, and Google Cloud
The same practices apply on every major cloud, but each provider names its mechanisms differently. This table lines up the native tools that deliver each control, so a team working across more than one cloud can see the equivalents at a glance.
| Control area | AWS | Azure | Google Cloud |
|---|---|---|---|
| Least-privilege identity | Scope IAM roles tightly, review with IAM Access Analyzer | Scope Entra ID roles, run access reviews | Scope IAM roles, review with IAM Recommender |
| No long-lived credentials | IAM roles for workloads with short-lived STS tokens | Managed identities | Workload Identity |
| Control plane audit logging | CloudTrail | Azure Monitor and Entra ID sign-in logs | Cloud Audit Logs |
| Threat detection | GuardDuty and Security Hub | Defender for Cloud | Security Command Center |
| Guardrails as code | AWS Config rules | Azure Policy | Organization Policy constraints |
| Posture baseline | CIS Benchmarks kept continuous with CSPM | CIS Benchmarks via Defender for Cloud | CIS Benchmarks via Security Command Center |
What cloud breaches teach us
The 2019 Capital One breach is the clearest lesson in why these practices matter and how they interlock. An attacker exploited a server-side request forgery flaw in a misconfigured web application firewall to reach the EC2 instance metadata service, retrieved the credentials of an over-permissioned IAM role attached to that instance, and used them to list and copy data from S3, exposing information on roughly 100 million people. No single control failed in isolation. A tighter IAM role would have limited what the stolen credentials could reach, enforcing IMDSv2 would have blunted the metadata theft, strict egress control would have hampered exfiltration, and object-level logging is what ultimately scoped the damage. Best practices are not a checklist of independent items; they are overlapping layers, and the depth is the point.
Practice cloud security best practices hands-on
Reading about these controls builds awareness; applying them against real infrastructure builds skill. Pwned Labs provisions live cloud environments for every exercise, so you can see how an attacker abuses a weak IAM policy or an exposed service, then apply the fix. Explore hands-on cloud security labs, and deepen the concepts with our explainers on cloud security posture management and cloud misconfiguration. The attacks that defeat each of these controls are what Pwned Labs teaches in its cloud bootcamps: the Amazon Cloud Attack and Defense track leading to the ACRTP certification, the Microsoft Cloud Attack and Defense track leading to MCRTP, and the Google Cloud Attack and Defense track leading to GCRTP. To learn that attacker tradecraft and validate it with a certification, see our cloud penetration testing certification and training.
Frequently asked questions
What are the most important cloud security best practices?
Eliminate long-lived credentials, scope identities to what they actually use, enable and retain the logs that matter, and keep backups outside the blast radius of the environment they protect. Almost every documented cloud intrusion is defeated or contained by one of those four.
Is network security still relevant in the cloud?
Yes, and it is secondary to identity. Network controls reduce exposure, and an attacker with valid credentials making authenticated API calls is not stopped by them, which is why identity is where the effort belongs.
What is the most common cloud security mistake?
Permissions granted to make something work and never revisited. The permission is rarely obviously dangerous, which is exactly why it survives review and why privilege escalation paths accumulate quietly.
Which logs should be enabled by default?
Control plane audit logging everywhere, plus data plane logging on anything holding sensitive information. Object-level access logging is off by default on every major provider, and its absence is the single most common reason investigations cannot answer what was taken.
Do I need my own cloud account to practice this?
No. Pwned Labs provisions live cloud environments for every lab, so you apply these practices in real infrastructure rather than your own.
About Pwned Labs
Pwned Labs is a hands-on cloud and AI offensive security training platform. It runs real-world attack labs and bootcamps for AWS, Azure, GCP, Kubernetes and AI systems, including the ACRTP, MCRTP, GCRTP, KRTP and AISRTP certifications. Free labs are at pwnedlabs.io/explore.