> For the complete documentation index, see [llms.txt](https://help.rzr.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.rzr.com/readme/audience-sharing-setup/s3-bucket-setup.md).

# S3 Bucket Setup

This document outlines how to connect to and use an Audience S3 bucket for RZR. It covers three options:

1. [Cyberduck](#option-1-using-cyberduck)
2. [AWS Command Line Interface (CLI)](#option-2-using-aws-cli-command-line-interface)
3. [Python script](#option-3-using-a-script)

***

### Option 1: Using Cyberduck

To connect to a S3 bucket from Windows PC / Mac we use a client called Cyberduck.

To download this program you need to access the following link: <a href="https://cyberduck.io/" class="button primary" data-icon="hand-pointer">cyberduck.io</a>

After downloading the Cyberduck client, run the program (as an Administrator in Windows).

The installation process is very simple:

* When prompted with the Cyberduck Welcome screen, press the Install button and the\
  program will be installed automatically.
* After the installation is done, run the program.

In the bottom left corner of the program you will find the “+” button to create a new bookmark

<figure><img src="/files/fFO8LD0WzWtpDEZuBLzS" alt=""><figcaption></figcaption></figure>

Click on the “+” button to show the new Bookmark dialog box

<figure><img src="/files/mxZJCF3kz9gnQ1HePoKb" alt=""><figcaption></figcaption></figure>

In the first field the **Amazon S3** (Amazon Simple Storage Service) protocol must be selected. After that the following fields MUST be completed:

* **Nickname**: give a name for the connection (for example, RZR)
* **Server**: must be set to s3.amazonaws.com
* **Port**: must be set to 443
* **Access Key ID**: your Access Key ID for the desired bucket must be entered (to be provided)
* **Path**: must be set to the folder name provided to you
* **Secret Access Key**: To be shared

Close the bookmark dialog box, and double click on the newly created bookmark to establish the\
connection.

<figure><img src="/files/DLliZ4hsqLA58gIE99tr" alt=""><figcaption></figcaption></figure>

***

### Option 2: Using AWS CLI (Command Line Interface)

To connect to S3 bucket using AWS Command Line Interface or CLI, please follow the instructions as listed by Amazon <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions" class="button primary" data-icon="hand-pointer">AWS CLI</a>

Once installed, open a shell and configure a profile for RZR

* <mark style="color:$primary;">`aws configure --profile aarki_s3`</mark>

Add the access keys in the prompt

* <mark style="color:$primary;">`AWS Access Key ID:`</mark> Your Access Key ID for the desired bucket (to be provided)
* <mark style="color:$primary;">`AWS Secret Access Key:`</mark> (To be shared)
* <mark style="color:$primary;">`Default region name [None]: us-east-1`</mark>
* <mark style="color:$primary;">`Default output format [None]:`</mark>

Now copy the file using the following commands:

* <mark style="color:$primary;">`aws s3 cp FILE_PATH_ON_COMPUTER s3://S3_PATH --profile aarki_s3`</mark>

where

* <mark style="color:$primary;">`FILE_PATH_ON_COMPUTER:`</mark> The file you want to copy to S3 bucket&#x20;
* <mark style="color:$primary;">`S3_PATH:`</mark> The name of bucket provided to you by RZR

***

### Option 3: Using a script

If you prefer to use a script to upload files to the S3 bucket, you can use the following code example\
that you can save as **upload\_s3.py**.

<pre data-overflow="wrap"><code>import argparse
import boto3
from botocore.exceptions import NoCredentialsError, PartialCredentialsError
import os

def upload_to_s3(local_file, bucket_name, s3_file, aws_access_key_id,
aws_secret_access_key, region_name='us-east-1'):
        # Create an S3 client with hardcoded credentials
        s3 = boto3.client('s3',
                        aws_access_key_id=aws_access_key_id,
<strong>                        aws_secret_access_key=aws_secret_access_key,
</strong>                        region_name=region_name)
        try:
                        s3.upload_file(local_file, bucket_name, s3_file)
                        print(f"Upload Successful: {local_file} to s3://{bucket_name}/{s3_file}")
        except FileNotFoundError:
                        print(f"The file {local_file} was not found")
        except NoCredentialsError:
                        print("Credentials not available")
        except PartialCredentialsError:
                        print("Incomplete credentials")
        except Exception as e:
                        print(f"An error occurred: {e}")

if __name__ == "__main__":
                AWS_ACCESS_KEY_ID = 'REPLACE_THIS_WITH_AWS_ACCESS_KEY_ID'
                AWS_SECRET_ACCESS_KEY = 'REPLACE_THIS_WITH_AWS_SECRET_ACCESS_KEY'
                AWS_REGION = 'us-east-1'

       parser = argparse.ArgumentParser(description="Upload a file to an S3 bucket")
       parser.add_argument('--local_file', required=True, help="Path to the local file")
       parser.add_argument('--bucket_name', required=True, help="Name of the S3 bucket")
       parser.add_argument('--s3_file', required=True, help="S3 object key (path in the bucket)")
       parser.add_argument('--aws_access_key_id', default=AWS_ACCESS_KEY_ID, help="AWS Access Key ID")
       parser.add_argument('--aws_secret_access_key', default=AWS_SECRET_ACCESS_KEY, help="AWS Secret Access Key")
       parser.add_argument('--region_name', default=AWS_REGION, help="AWS region name (default: us-east-1)")
       
       args = parser.parse_args()
       
       upload_to_s3(args.local_file, args.bucket_name, args.s3_file, args.aws_access_key_id, args.aws_secret_access_key, args.region_name)
</code></pre>

In the above example, replace the highlighted red text as follows

* <mark style="color:$danger;">`REPLACE_THIS_WITH_AWS_ACCESS_KEY_ID:`</mark> Your Access Key ID for the desired bucket (to be provided)
* <mark style="color:red;">`REPLACE_THIS_WITH_AWS_SECRET_ACCESS_KEY:`</mark> (To be shared)

To run the script, use the following command from a shell

{% code overflow="wrap" %}

```
python3 upload_s3.py --bucket_name BUCKET_NAME --s3_file FILE_NAME_TO_UPLOAD --local_file FILE_NAME_TO_UPLOAD
```

{% endcode %}

where

* <mark style="color:$primary;">`upload_s3.py:`</mark> The name of the script&#x20;
* <mark style="color:$primary;">`BUCKET_NAME:`</mark> The folder name provided to you&#x20;
* <mark style="color:$primary;">`FILE_NAME_TO_UPLOAD:`</mark> The name of the file to upload

***

This guide covers everything you need to upload audiences to RZR via S3 Bucket — including connection options, required credentials, and step-by-step instructions for Cyberduck, AWS CLI, and Python.

If you need help with setup, reach out to your **RZR Account Manager** or **Account Coordinator** for assistance.
