# Deny AWS RAM sharing with external accounts

Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.

Deny AWS RAM sharing with external accounts is an AWS guardrail written in service control policies. Denies ram:CreateResourceShare and ram:UpdateResourceShare when the share allows external principals. What it breaks: sharing resources such as VPC subnets with accounts outside the organization fails for every principal in the affected accounts.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Deny",
      "Action": [
        "ram:CreateResourceShare",
        "ram:UpdateResourceShare"
      ],
      "Resource": "*",
      "Condition": {
        "Bool": {
          "ram:RequestedAllowsExternalPrincipals": "true"
        }
      }
    }
  ]
}
```

- **Blocks:** Denies ram:CreateResourceShare and ram:UpdateResourceShare when the share allows external principals.
- **Breaks:** Sharing resources such as VPC subnets with accounts outside the organization fails for every principal in the affected accounts. ([source](https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Sensitive-data-protection/README.md))
- **Test before applying:** As for every Service control policies guardrail: [how to test before enforcing](/mechanisms/scp/)
- **Mechanism:** [Service control policies (SCPs)](/mechanisms/scp/): IAM users, IAM roles and the root user in member accounts; not the management account and not service-linked roles.
- **Taken from:** [open source set](https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Sensitive-data-protection/Deny-RAM-from-sharing-resources-to-external-accounts.json), MIT-0 (README states MIT-0; LICENSE file fetched, MIT-0 text, Copyright Amazon.com, Inc.): https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/LICENSE

## What the policy text names

It names 2 actions or patterns: `ram:CreateResourceShare`, `ram:UpdateResourceShare`. Its conditions test `ram:RequestedAllowsExternalPrincipals`.

## What the source says

"ram:RequestedAllowsExternalPrincipals: true" (read 10 Nov 2026).

On what it breaks: "Deny users or roles from sharing resources with external account principals."

## Related guardrails

- [Storage SAS tokens should adhere to 7 day maximum validity](/guardrails/azure-policy-storage-sas-7-days/): Azure, Azure Policy (built-in definitions), data exfiltration
- [Domain restricted sharing](/guardrails/gcp-orgpolicy-domain-restricted-sharing/): Google Cloud, Organization Policy Service (managed and legacy constraints), data exfiltration
- [Service perimeter around managed services](/guardrails/gcp-vpcsc-service-perimeter/): Google Cloud, VPC Service Controls (service perimeters), data exfiltration
- [Block public sharing of EBS snapshots (declarative policy)](/guardrails/aws-declarative-snapshot-block-public-access/): AWS, Declarative policies, data exfiltration

## Related pages

- [Require IAM authentication on Lambda function URLs (AWS Service control policies)](/guardrails/aws-scp-require-lambda-url-iam-auth/)
- [Require HTTPS for access to resources (AWS Resource control policies)](/guardrails/aws-rcp-require-https/)
- [Require TLS 1.2 or later for S3 (AWS Resource control policies)](/guardrails/aws-rcp-s3-minimum-tls-1-2/)

## Sources

- Deny AWS RAM sharing with external accounts: https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Sensitive-data-protection/Deny-RAM-from-sharing-resources-to-external-accounts.json (read 10 Nov 2026)
- What it breaks: https://raw.githubusercontent.com/aws-samples/service-control-policy-examples/main/Sensitive-data-protection/README.md (read 10 Nov 2026)
- How to test it first: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/aws-scp-deny-ram-external-sharing/
