> For the complete documentation index, see [llms.txt](https://docs.impossiblecloud.com/impossible-cloud-help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.impossiblecloud.com/impossible-cloud-help/security/identity-access-management-iam/managing-policies/policy-conditions.md).

# Policy Conditions

### Policy Conditions

In addition to controlling *which actions* users can perform, you can also control *under what circumstances* those actions are allowed. Policy conditions let you add extra requirements that must be met before access is granted.

#### IP Address Conditions

One of the most useful conditions is restricting access based on the client's IP address. This is ideal for:

* Limiting bucket access to your corporate network
* Ensuring backups only run from designated servers
* Meeting compliance requirements for data access controls

**IpAddress Condition**

The `IpAddress` condition allows access only when requests come from specified IP addresses or ranges:

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::my-bucket",
                "arn:aws:s3:::my-bucket/*"
            ],
            "Condition": {
                "IpAddress": {
                    "aws:SourceIp": "203.0.113.0/24"
                }
            }
        }
    ]
}
```

This policy grants access only to requests originating from the 203.0.113.0/24 network.

**NotIpAddress Condition**

The `NotIpAddress` condition allows access from all IP addresses *except* those specified:

```json
"Condition": {
    "NotIpAddress": {
        "aws:SourceIp": "198.51.100.0/24"
    }
}
```

**Supported CIDR Ranges Examples**

IP addresses must be specified using CIDR notation:

* `/32` — Single IP (e.g., `203.0.113.25/32`)
* `/24` — Class C network (e.g., `203.0.113.0/24`)
* `/16` — Class B network (e.g., `203.0.0.0/16`)
* `/8` — Class A network (e.g., `203.0.0.0/8`)
* `/0` — All addresses (e.g., `0.0.0.0/0`)

For detailed examples and step-by-step instructions, see How to Restrict Bucket Access by IP Address.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.impossiblecloud.com/impossible-cloud-help/security/identity-access-management-iam/managing-policies/policy-conditions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
