# Standard Commands

This document provides instructions for managing <code class="expression">space.vars.ionos\_cloud\_object\_storage</code> using the AWS CLI. Additionally, this task can also be performed through the DCD [<mark style="color:blue;">DCD</mark>](https://docs.ionos.com/sections-test/guides/storage-and-backup/ionos-object-storage/get-started/setup-access) and [<mark style="color:blue;">API</mark>](https://api.ionos.com/docs/s3/v2/#section/Overview).

{% hint style="info" %}
**Prerequisites:**

* Set up the AWS CLI by following the [<mark style="color:blue;">installation instructions</mark>](https://docs.ionos.com/sections-test/guides/storage-and-backup/ionos-object-storage/s3-tools/awscli/awscli-configure).
* Make sure to consider the supported [<mark style="color:blue;">Endpoints</mark>](https://docs.ionos.com/sections-test/guides/storage-and-backup/ionos-object-storage/endpoints).
  {% endhint %}

### Examples

#### List buckets

* Option 1: Using s3 set of commands:

  ```
  aws s3 ls --endpoint-url https://s3.eu-central-2.ionoscloud.com
  ```
* Option 2: Using s3api set of commands:

  ```
  aws s3api list-buckets --endpoint-url https://s3.eu-central-2.ionoscloud.com
  ```
* Create a bucket in the `eu-central-2` region (Berlin, Germany):
  * Option 1: Using s3 set of commands:

    ```
    aws s3 mb s3://my-bucket --region eu-central-2 --endpoint-url https://s3.eu-central-2.ionoscloud.com
    ```
  * Option 2: Using s3api set of commands:

    ```
    aws s3api create-bucket --bucket my-bucket --region=eu-central-2 --create-bucket-configuration LocationConstraint=eu-central-2 --endpoint-url https://s3.eu-central-2.ionoscloud.com
    ```
* Create a bucket in the `de` region (Frankfurt, Germany) with Object Lock enabled:

  ```
  aws s3api create-bucket --bucket my-bucket --object-lock-enabled-for-bucket --region=de --create-bucket-configuration LocationConstraint=de --endpoint-url https://s3.eu-central-1.ionoscloud.com
  ```

#### Upload and download objects

* Upload an object from the current directory to a bucket:

  ```
  aws s3 cp filename.txt s3://my-bucket --endpoint-url https://s3.eu-central-2.ionoscloud.com

  ```
* Download all the objects from the `my-bucket` bucket to the local directory `my-dir`:

  ```
  aws s3 cp s3://my-bucket my-dir --recursive --endpoint-url https://s3.eu-central-2.ionoscloud.com

  ```

#### Copy and sync objects

* Copy the object to the bucket:

  ```
  aws s3 cp my-dir s3://my-bucket/ --recursive --endpoint-url https://s3.eu-central-2.ionoscloud.com
  ```
* Copy the contents of the local directory `my-dir` to the bucket `my-bucket`:

  ```
  aws s3 cp my-dir s3://my-bucket/ --recursive --endpoint-url https://s3.eu-central-2.ionoscloud.com
  ```

  For more information, see the [<mark style="color:blue;">cp command reference</mark>](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/cp.html).
* Copy all objects from `my-source-bucket` to `my-dest-bucket` excluding .zip files. The command does not support cross-region copying for <code class="expression">space.vars.ionos\_cloud\_object\_storage</code>:

  ```
  aws s3 cp s3://my-source-bucket/ s3://my-dest-bucket/ --recursive --exclude "*.zip" --endpoint-url https://s3.eu-central-2.ionoscloud.com`
  ```
* Sync the bucket `my-bucket` with the contents of the local directory `my-dir`:

  ```
  aws s3 sync my-dir s3://my-bucket --endpoint-url https://s3.eu-central-2.ionoscloud.com
  ```

For more information, see [<mark style="color:blue;">sync command reference</mark>](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/sync.html).
