> 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
