# Deny unauthenticated access to Cognito identity pools

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

Deny unauthenticated access to Cognito identity pools is an AWS guardrail written in resource control policies. Denies GetId, GetCredentialsForIdentity and GetOpenIdToken for unauthenticated (guest) identities in Cognito identity pools. What it breaks: applications that rely on guest access to an identity pool can no longer obtain credentials; only authenticated users can.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyUnauthenticatedIdentityPoolAccess",
      "Effect": "Deny",
      "Principal": "*",
      "Action": [
        "cognito-identity:GetId",
        "cognito-identity:GetCredentialsForIdentity",
        "cognito-identity:GetOpenIdToken"
      ],
      "Resource": "*",
      "Condition": {
        "StringLike": {
          "cognito-identity-unauth:IdentityPoolArn": "*"
        }
      }
    }
  ]
}
```

- **Blocks:** Denies GetId, GetCredentialsForIdentity and GetOpenIdToken for unauthenticated (guest) identities in Cognito identity pools.
- **Breaks:** Applications that rely on guest access to an identity pool can no longer obtain credentials; only authenticated users can. ([source](https://raw.githubusercontent.com/aws-samples/resource-control-policy-examples/main/Service-specific-controls/README.md))
- **Test before applying:** As for every Resource control policies guardrail: [how to test before enforcing](/mechanisms/rcp/)
- **Mechanism:** [Resource control policies (RCPs)](/mechanisms/rcp/): Resources of supported services in member accounts, for any principal calling them; not resources in the management account and not service-linked roles.
- **Taken from:** [open source set](https://raw.githubusercontent.com/aws-samples/resource-control-policy-examples/main/Service-specific-controls/Cognito-Deny-identity-pool-unauthenticated-access.json), MIT-0 (README states MIT-0; LICENSE file fetched, MIT-0 text, Copyright Amazon.com, Inc.): https://raw.githubusercontent.com/aws-samples/resource-control-policy-examples/main/LICENSE

## What the policy text names

It names 3 actions or patterns: `cognito-identity:GetId`, `cognito-identity:GetCredentialsForIdentity`, `cognito-identity:GetOpenIdToken`. Its conditions test `cognito-identity-unauth:IdentityPoolArn`.

## What the source says

`cognito-identity-unauth:IdentityPoolArn` (read 10 Nov 2026).

On what it breaks: "ensuring only authenticated users can obtain credentials."

## Related guardrails

- [Network interfaces should not have public IPs](/guardrails/azure-policy-nic-no-public-ip/): Azure, Azure Policy (built-in definitions), public exposure
- [Configure storage accounts to disallow public blob access](/guardrails/azure-policy-storage-disable-public-blob/): Azure, Azure Policy (built-in definitions), public exposure
- [Storage accounts should disable public network access](/guardrails/azure-policy-storage-disable-public-network/): Azure, Azure Policy (built-in definitions), public exposure
- [Deny disabling block public access for AMIs](/guardrails/aws-scp-deny-disable-ami-block-public-access/): AWS, Service control policies (SCPs), public exposure
- [Require IAM authentication on Lambda function URLs](/guardrails/aws-scp-require-lambda-url-iam-auth/): AWS, Service control policies (SCPs), public exposure
- [Deny changes to S3 Block Public Access at bucket level](/guardrails/aws-rcp-deny-bucket-public-access-block-changes/): AWS, Resource control policies (RCPs), public exposure

## Related pages

- [Deny S3 customer-provided encryption keys (SSE-C) (AWS Resource control policies)](/guardrails/aws-rcp-deny-s3-sse-c/)
- [Restrict access to resources in a suspended OU (AWS Resource control policies)](/guardrails/aws-rcp-restrict-suspended-ou-resources/)
- [Block internet gateway ingress for VPCs (declarative policy) (AWS Declarative policies)](/guardrails/aws-declarative-vpc-block-public-access/)

## Sources

- Deny unauthenticated access to Cognito identity pools: https://raw.githubusercontent.com/aws-samples/resource-control-policy-examples/main/Service-specific-controls/Cognito-Deny-identity-pool-unauthenticated-access.json (read 10 Nov 2026)
- What it breaks: https://raw.githubusercontent.com/aws-samples/resource-control-policy-examples/main/Service-specific-controls/README.md (read 10 Nov 2026)
- How to test it first: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps_examples.html (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/aws-rcp-deny-cognito-unauthenticated-access/
