> For the complete documentation index, see [llms.txt](https://docs.eazybackup.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eazybackup.com/e3-object-storage/advanced/bucket-policies-overview.md).

# Bucket policies overview

Bucket policies in e3 Object Storage — overview and links to policy examples.

Bucket policies are JSON documents attached to a bucket that **Allow** or **Deny** actions for principals (users, accounts, or `*`).

e3 Object Storage uses the S3 policy model (`Version`: `2012-10-17`).

{% hint style="info" %}
Bucket policies are applied with S3-compatible tools (e.g. **AWS CLI**), not from the e3 Object Storage dashboard UI. You need the bucket owner’s credentials and [Connection details](/e3-object-storage/getting-started/connection-details.md).
{% endhint %}

## Policy structure

Each **Statement** includes:

* **Effect** — `Allow` or `Deny` (`Deny` overrides `Allow`)
* **Principal** — who the rule applies to
* **Action** — S3 operations (e.g. `s3:PutObject`, `s3:GetObject`)
* **Resource** — bucket ARN or object ARN (`arn:aws:s3:::bucket` or `arn:aws:s3:::bucket/*`)
* **Condition** — optional (IP address, prefix, etc.)

## Account ID and username

Find **Account ID** and **Username** on **Access Keys** or **Users**. Principal ARN format:

`arn:aws:iam::ACCOUNT_ID:user/USERNAME`

## Example guides

| Goal                               | Article               |
| ---------------------------------- | --------------------- |
| Deny uploads for a specific user   | Basic bucket policy   |
| Allow only certain file extensions | File extension policy |
| Restrict access by IP              | IP restriction policy |

## Apply a policy (AWS CLI)

```bash
aws s3api put-bucket-policy \
  --bucket YOUR_BUCKET \
  --policy file://policy.json \
  --endpoint-url https://s3.ca-central-1.eazybackup.com \
  --profile e3
```

Replace `YOUR_BUCKET` and ensure `policy.json` is valid JSON. See AWS CLI and s3cmd.
