<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AWS ☁️]]></title><description><![CDATA[AWS ☁️]]></description><link>https://aws-cloudd.hashnode.dev</link><image><url>https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/logos/66d95b008a1450e911d135e1/b8aaf8c7-bcc9-4361-9c0a-dc591582fea5.webp</url><title>AWS ☁️</title><link>https://aws-cloudd.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 24 Oct 2026 08:40:02 GMT</lastBuildDate><atom:link href="https://aws-cloudd.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[AWS SCP's Demystified — When, Why, and How to Use Them in AWS]]></title><description><![CDATA[SCP (Service Control Policy) is a policy type used in Amazon Web Services (AWS) under AWS Organizations. 👉 It sets maximum permission boundaries for AWS…]]></description><link>https://aws-cloudd.hashnode.dev/aws-scp-s-demystified-when-why-and-how-to-use-them-in-aws</link><guid isPermaLink="true">https://aws-cloudd.hashnode.dev/aws-scp-s-demystified-when-why-and-how-to-use-them-in-aws</guid><category><![CDATA[AWS]]></category><category><![CDATA[Cloud Computing]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Developer]]></category><category><![CDATA[Security]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Aditya Patil]]></dc:creator><pubDate>Sat, 21 Feb 2026 07:06:01 GMT</pubDate><enclosure url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/66d95b008a1450e911d135e1/5b9d72af-3d85-4669-bd40-be1ef5cdf4b9.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3><mark class="bg-yellow-200 dark:bg-yellow-500/30">Q. What is SCP in AWS, and how does it differ from IAM roles or policies? What exactly is it, when should we use it, with which services, and why was SCP introduced?</mark></h3>
<h2><mark class="bg-yellow-200 dark:bg-yellow-500/30"><br /></mark><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🔐 What is SCP in AWS?</mark></strong></h2>
<p><strong>SCP (Service Control Policy)</strong> is a policy type used in <strong>Amazon Web Services (AWS)</strong> under <strong>AWS Organizations</strong>.</p>
<p>👉 It sets <strong>maximum permission boundaries</strong> for AWS accounts in an organization.</p>
<p>It does <strong>NOT grant permissions</strong>.<br />It only <strong>limits what IAM users/roles <em>can</em> do</strong>, even if IAM allows it.</p>
<hr />
<h2><strong>🏢 Where SCP is Used?</strong></h2>
<p>SCP is used only with:</p>
<ul>
<li><p><strong>AWS Organizations</strong></p>
</li>
<li><p>Applied to:</p>
<ul>
<li><p>Organization Root</p>
</li>
<li><p>Organizational Units (OUs)</p>
</li>
<li><p>Individual AWS Accounts</p>
</li>
</ul>
</li>
</ul>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🆚 SCP vs IAM Role vs IAM Policy</mark></strong></h2>
<table style="min-width:100px"><colgroup><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col></colgroup><tbody><tr><th><p><strong>Feature</strong></p></th><th><p><strong>SCP</strong></p></th><th><p><strong>IAM Policy</strong></p></th><th><p><strong>IAM Role</strong></p></th></tr><tr><td><p>Scope</p></td><td><p>Entire AWS Account</p></td><td><p>Specific user/role</p></td><td><p>Assumable identity</p></td></tr><tr><td><p>Grants permission?</p></td><td><p>❌ No</p></td><td><p>✅ Yes</p></td><td><p>✅ Yes (via attached policy)</p></td></tr><tr><td><p>Limits permission?</p></td><td><p>✅ Yes</p></td><td><p>❌ No (unless explicit deny)</p></td><td><p>❌ No</p></td></tr><tr><td><p>Works at what level?</p></td><td><p>Organization level</p></td><td><p>Account level</p></td><td><p>Account level</p></td></tr><tr><td><p>Used with</p></td><td><p>AWS Organizations</p></td><td><p>IAM</p></td><td><p>IAM</p></td></tr></tbody></table>

<hr />
<h2><strong>🎯 Simple Example</strong></h2>
<p>Imagine:</p>
<ul>
<li><p>IAM Policy says: "Allow EC2 full access"</p>
</li>
<li><p>SCP says: "Deny EC2 in this account"</p>
</li>
</ul>
<p>👉 Final result = <strong>EC2 access denied</strong></p>
<p>Because:</p>
<blockquote>
<p>🔥 SCP is the guardrail. IAM works <em>inside</em> that guardrail.</p>
</blockquote>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🤔 Why Was SCP Introduced?</mark></strong></h2>
<p>Before SCP:</p>
<ul>
<li><p>Large companies had <strong>100+ AWS accounts</strong></p>
</li>
<li><p>Developers could accidentally:</p>
<ul>
<li><p>Delete CloudTrail</p>
</li>
<li><p>Disable security services</p>
</li>
<li><p>Launch costly services</p>
</li>
<li><p>Create resources in wrong region</p>
</li>
</ul>
</li>
</ul>
<p>AWS needed:</p>
<p>✔ Centralized control<br />✔ Security guardrails<br />✔ Compliance enforcement<br />✔ Cost control</p>
<p>So AWS introduced SCP inside AWS Organizations.</p>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">📌 When Do We Use SCP?</mark></strong></h2>
<h3><strong>1️⃣ Restrict AWS Regions</strong></h3>
<p>Example: Allow only <code>ap-south-1</code></p>
<h3><strong>2️⃣ Block Dangerous Services</strong></h3>
<p>Example:</p>
<ul>
<li><p>Deny <code>iam:*</code></p>
</li>
<li><p>Deny <code>organizations:LeaveOrganization</code></p>
</li>
</ul>
<h3><strong>3️⃣ Prevent Root User Misuse</strong></h3>
<p>Deny certain actions for all accounts.</p>
<h3><strong>4️⃣ Compliance &amp; Governance</strong></h3>
<p>Force:</p>
<ul>
<li><p>CloudTrail always enabled</p>
</li>
<li><p>Prevent deleting security tools</p>
</li>
</ul>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🏗 Real DevOps Example (Enterprise Setup)</mark></strong></h2>
<p>Company Structure:</p>
<pre><code class="language-plaintext">Root
 ├── Prod OU
 ├── Dev OU
 ├── Sandbox OU
</code></pre>
<h3><strong>SCP Example:</strong></h3>
<ul>
<li><p>Dev OU → Deny RDS creation</p>
</li>
<li><p>Sandbox → Allow only limited services</p>
</li>
<li><p>Prod → Deny region except Mumbai</p>
</li>
</ul>
<hr />
<h2><strong>🧠 Important Rule (Interview Gold)</strong></h2>
<p>Effective permission =</p>
<pre><code class="language-plaintext">IAM Allow
AND
SCP Allow
AND
No Explicit Deny anywhere
</code></pre>
<p>If SCP denies → ❌ Access denied (even for Admin role)</p>
<hr />
<h2><strong>🚨 Key Point Most People Miss</strong></h2>
<p>SCP affects:</p>
<ul>
<li><p>IAM users</p>
</li>
<li><p>IAM roles</p>
</li>
<li><p>Even root user</p>
</li>
</ul>
<p>But:</p>
<ul>
<li>It does NOT affect management account (by default)</li>
</ul>
<hr />
<h2><strong>🎯 Final One-Line Understanding</strong></h2>
<blockquote>
<p>IAM gives permissions.<br />SCP defines the maximum allowed boundary for the entire account.</p>
</blockquote>
<hr />
<h2><mark class="bg-yellow-200 dark:bg-yellow-500/30">Q. So SCP is above IAM roles and policies, correct?</mark></h2>
<p>✅ <strong>Yes — in short:</strong></p>
<p>👉 <strong>SCP sits on top of IAM roles and policies.</strong></p>
<p>Think of it like this:</p>
<pre><code class="language-plaintext">SCP  →  Maximum allowed limit (Org level guardrail)
IAM  →  Grants actual permissions (Account level)
</code></pre>
<h3><strong>🔑 Final Permission Rule:</strong></h3>
<p>Access is allowed only if:</p>
<ul>
<li><p>IAM policy = Allow ✅</p>
</li>
<li><p>SCP = Allow ✅</p>
</li>
<li><p>No explicit deny ❌</p>
</li>
</ul>
<p>If SCP denies → <strong>Access denied</strong>, even if IAM role says Allow.</p>
<hr />
<h3><strong>🧠 1-Line Interview Answer:</strong></h3>
<blockquote>
<p>SCP defines the maximum permission boundary at the organization level, while IAM roles and policies grant permissions within that boundary.</p>
</blockquote>
<p>That's it. 🔥</p>
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🔥 Real-Time SCP JSON Example + Where It’s Used</mark></strong></h2>
<h3><strong>🎯 Scenario 1: Restrict Regions (Enterprise Governance)</strong></h3>
<p>Company wants all accounts to use only <strong>Mumbai region (</strong><code>ap-south-1</code><strong>)</strong></p>
<h3><strong>✅ SCP JSON</strong></h3>
<pre><code class="language-plaintext">{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyAllRegionsExceptMumbai",
      "Effect": "Deny",
      "NotAction": [
        "iam:*",
        "organizations:*",
        "route53:*",
        "cloudfront:*"
      ],
      "Resource": "*",
      "Condition": {
        "StringNotEquals": {
          "aws:RequestedRegion": "ap-south-1"
        }
      }
    }
  ]
}
</code></pre>
<h3><strong>📌 Where It’s Used?</strong></h3>
<ul>
<li><p>Created in <strong>AWS Organizations</strong></p>
</li>
<li><p>Attached to:</p>
<ul>
<li><p>Root</p>
</li>
<li><p>OU (e.g., Prod OU)</p>
</li>
<li><p>Specific AWS Account</p>
</li>
</ul>
</li>
</ul>
<hr />
<h3><strong>🎯 Scenario 2: Prevent Developers from Deleting Security Logs</strong></h3>
<p>Company wants to prevent deletion of:</p>
<ul>
<li><p>CloudTrail</p>
</li>
<li><p>Config</p>
</li>
<li><p>GuardDuty</p>
</li>
</ul>
<pre><code class="language-plaintext">{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenySecurityServiceDeletion",
      "Effect": "Deny",
      "Action": [
        "cloudtrail:DeleteTrail",
        "config:DeleteConfigRule",
        "guardduty:DeleteDetector"
      ],
      "Resource": "*"
    }
  ]
}
</code></pre>
<hr />
<h3><strong>🏢 Real Enterprise Usage Example</strong></h3>
<p>Structure in <strong>Amazon Web Services</strong> Organization:</p>
<pre><code class="language-plaintext">Root
 ├── Prod OU
 ├── Dev OU
 ├── Sandbox OU
</code></pre>
<table style="min-width:50px"><colgroup><col style="min-width:25px"></col><col style="min-width:25px"></col></colgroup><tbody><tr><th><p><strong>OU</strong></p></th><th><p><strong>SCP Use Case</strong></p></th></tr><tr><td><p>Prod</p></td><td><p>Allow only Mumbai region</p></td></tr><tr><td><p>Dev</p></td><td><p>Deny RDS creation</p></td></tr><tr><td><p>Sandbox</p></td><td><p>Allow only EC2 + S3</p></td></tr><tr><td><p>All Accounts</p></td><td><p>Deny leaving organization</p></td></tr></tbody></table>

<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">💡 Why SCP Is Used?</mark></strong></h2>
<p>✔ Centralized governance<br />✔ Cost control<br />✔ Security guardrails<br />✔ Compliance enforcement<br />✔ Prevent root misuse</p>
<hr />
<h2><strong>🎯 Interview-Ready 2-Min Answer</strong></h2>
<blockquote>
<p>Service Control Policy (SCP) is a policy type in AWS Organizations that defines the maximum permission boundary for AWS accounts. It does not grant permissions but restricts what IAM users and roles can do within member accounts.</p>
<p>SCPs are applied at the Organization root, OU, or account level. They are mainly used in multi-account enterprise environments to enforce governance, security, and compliance controls centrally.</p>
<p>For example, we can use SCP to restrict AWS regions to only ap-south-1, prevent deletion of CloudTrail logs, block certain high-cost services, or deny IAM modifications in production accounts.</p>
<p>Even if an IAM role has AdministratorAccess, if SCP denies an action, the request will be blocked. So effective permission is the intersection of IAM policy and SCP.</p>
<p>In real enterprise setups, SCP acts as an organizational guardrail, while IAM provides account-level access control.</p>
</blockquote>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🔥 SCP vs Permission Boundary vs IAM Policy (Clear Comparison)</mark></strong></h2>
<table style="min-width:100px"><colgroup><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col></colgroup><tbody><tr><th><p><strong>Feature</strong></p></th><th><p><strong>SCP</strong></p></th><th><p><strong>Permission Boundary</strong></p></th><th><p><strong>IAM Policy</strong></p></th></tr><tr><td><p>Level</p></td><td><p>Organization</p></td><td><p>IAM User/Role level</p></td><td><p>IAM User/Role level</p></td></tr><tr><td><p>Defined In</p></td><td><p>AWS Organizations</p></td><td><p>AWS Identity and Access Management</p></td><td><p>AWS IAM</p></td></tr><tr><td><p>Grants Permission?</p></td><td><p>❌ No</p></td><td><p>❌ No</p></td><td><p>✅ Yes</p></td></tr><tr><td><p>Restricts Permission?</p></td><td><p>✅ Yes</p></td><td><p>✅ Yes</p></td><td><p>❌ (unless explicit deny)</p></td></tr><tr><td><p>Affects</p></td><td><p>Entire AWS Account</p></td><td><p>Specific IAM user/role</p></td><td><p>Specific IAM user/role</p></td></tr><tr><td><p>Use Case</p></td><td><p>Enterprise guardrails</p></td><td><p>Control delegated admins</p></td><td><p>Day-to-day access control</p></td></tr></tbody></table>

<hr />
<h2><strong>🧠 Simple Understanding</strong></h2>
<pre><code class="language-plaintext">SCP → Maximum limit for whole account
Permission Boundary → Maximum limit for specific IAM role/user
IAM Policy → Grants actual permissions
</code></pre>
<h3><strong>🔑 Final Access Formula:</strong></h3>
<p>Access Allowed Only If:</p>
<pre><code class="language-plaintext">IAM Allow
AND Permission Boundary Allow
AND SCP Allow
AND No Explicit Deny
</code></pre>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🔍 Debugging “Access Denied” Due to SCP</mark></strong></h2>
<p>When you see:</p>
<pre><code class="language-plaintext">AccessDeniedException
</code></pre>
<p>Follow this step-by-step approach:</p>
<hr />
<h3><strong>✅ Step 1: Check IAM Policy</strong></h3>
<p>Go to:<br />IAM → User/Role → Permissions</p>
<p>Confirm:</p>
<ul>
<li><p>Is the action allowed?</p>
</li>
<li><p>Any explicit deny?</p>
</li>
</ul>
<hr />
<h3><strong>✅ Step 2: Check Permission Boundary</strong></h3>
<p>If attached:<br />IAM → Role → Permission Boundary<br />Ensure the boundary allows the action.</p>
<hr />
<h3><strong>✅ Step 3: Check SCP (Most People Miss This)</strong></h3>
<p>Go to:<br /><strong>AWS Organizations</strong><br />→ Accounts → Select Account<br />→ Policies → Service Control Policies</p>
<p>Look for:</p>
<ul>
<li><p>Explicit Deny</p>
</li>
<li><p>Region restriction</p>
</li>
<li><p>Service block</p>
</li>
</ul>
<hr />
<h3><strong>🚨 Real Debug Tip (Production Level)</strong></h3>
<p>Run:</p>
<pre><code class="language-plaintext">aws organizations describe-effective-policy \
--policy-type SERVICE_CONTROL_POLICY \
--target-id &lt;account-id&gt;
</code></pre>
<p>This shows effective SCP applied.</p>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🔥 Real-Time Production Incident Example (DevOps Scenario)</mark></strong></h2>
<h3><strong>🏢 Scenario</strong></h3>
<p>Company Structure:</p>
<pre><code class="language-plaintext">Root
 ├── Prod OU
 ├── Dev OU
</code></pre>
<p>SCP attached to Prod OU:</p>
<pre><code class="language-plaintext">{
  "Effect": "Deny",
  "Action": "ec2:TerminateInstances",
  "Resource": "*"
}
</code></pre>
<hr />
<h3><strong>💥 Incident</strong></h3>
<p>A DevOps engineer tries to terminate an EC2 instance in production during a scaling issue.</p>
<p>Even with:</p>
<ul>
<li>AdministratorAccess role</li>
</ul>
<p>Result:</p>
<pre><code class="language-plaintext">AccessDenied
</code></pre>
<hr />
<h3><strong>🧠 What Happened?</strong></h3>
<p>SCP explicitly denied <code>ec2:TerminateInstances</code>.</p>
<p>IAM allowed it.<br />But SCP overruled it.</p>
<hr />
<h3><strong>🎯 Why Company Did This?</strong></h3>
<p>To:</p>
<ul>
<li><p>Prevent accidental production shutdown</p>
</li>
<li><p>Protect critical systems</p>
</li>
<li><p>Enforce change management process</p>
</li>
</ul>
<p>Only break-glass account had no SCP restriction.</p>
<hr />
<h2><strong><mark class="bg-yellow-200 dark:bg-yellow-500/30">🔥 Another Real Enterprise Example (Cost Control)</mark></strong></h2>
<p>SCP attached to Sandbox OU:</p>
<pre><code class="language-plaintext">{
  "Effect": "Deny",
  "Action": [
    "rds:*",
    "redshift:*"
  ],
  "Resource": "*"
}
</code></pre>
<p>Purpose:</p>
<ul>
<li>Prevent developers from launching expensive databases.</li>
</ul>
<p>Saved company thousands per month.</p>
<hr />
<h1><strong>🎯 Interview-Ready Punch Line</strong></h1>
<blockquote>
<p>SCP is an organization-level guardrail that restricts the maximum permissions for AWS accounts. It works above IAM and permission boundaries. During debugging, if IAM and boundary look correct but access is still denied, SCP is usually the root cause.</p>
</blockquote>
<hr />
]]></content:encoded></item></channel></rss>