# How to update an Object Storage bucket

import Tabs from '~/components/tabs/Tabs'
import DocButton from '~/components/webkit/DocButton.vue';

This guide walks you through updating an Object Storage bucket using the Azion Console, Azion API, and Azion CLI. It includes changing the permissions of a bucket, which can be crucial for managing access to your data. 

## Updating a bucket

<Tabs client:visible>
    <Fragment slot="tab.console">Console</Fragment>
    <Fragment slot="tab.cli">Azion CLI</Fragment>
    <Fragment slot="tab.api">API</Fragment>

<Fragment slot="panel.console">

In the Azion [Console](https://console.azion.com/object-storage), you can update a bucket by following these steps:

1. Access the **Object Storage** menu in the Products menu.
2. On the Object Storage page, click on the bucket you want to update.
3. On the bucket page, click the **Settings** button.
4. Make the necessary changes to the permissions and click **Save** to apply the changes.
5. In **Danger Zone**, you can permanently delete the bucket.
Note: You cannot delete a bucket that is not empty. Additionally, objects deleted in the last 24 hours are also taken into account.

</Fragment>

<Fragment slot="panel.cli">

## Requirements 

- [Azion CLI installed](/en/documentation/products/azion-cli/overview/#installing-azion-cli). 
- [A personal token configured](/en/documentation/devtools/cli/globals/#token).

To update a bucket: 

```bash 
azion update edge-storage bucket
```

Azion CLI will present a series of interactions, so the bucket can be updated. Run `azion update edge-storage bucket -h` for further information about the data that can be updated. 

</Fragment>

<Fragment slot="panel.api">

In this example, you will change the permission of the bucket. 
Run the following `PATCH` request in your terminal, replacing `[TOKEN VALUE]` with your [personal token](/en/documentation/products/guides/personal-tokens/) and `bucket_name` with the name of the bucket to attribute the read-write permission:

```bash
curl --location --request PATCH 'https://api.azion.com/v4/storage/buckets/<bucket_name>' \
--header 'Accept: application/json;' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token [TOKEN VALUE]' \
--data '{
    "edge_access": "read_write"
}'
```

You should receive the following response:

```json
{
  "state": "executed",
  "data": {
    "name": "my-bucket-ro",
    "edge_access": "read_write"
  }
}
```

:::note 
The bucket's name cannot be updated.
:::

</Fragment>

</Tabs>

:::caution[Warning]
When a bucket is configured with **read-write permissions**, any user can access and modify its content (for example, by sending a PUT request to overwrite files). If the bucket is used as an origin for an application, this configuration may expose the content to unauthorized modifications. However, suppose the bucket is accessed through a function. In that case, the risk is managed by the logic implemented in the function code, allowing developers to enforce stricter controls over who can access or modify the data. To mitigate risks, always verify the required permissions for each use case and implement proper access controls. Read more on [Authentication and permissions](/en/documentation/products/store/object-storage/#authentication-and-permissions).
:::