> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure AWS CLI and Boto3 for AI Object Storage

> How to configure AWS CLI and Boto3 to use CoreWeave AI Object Storage

This page shows how to configure the AWS CLI and Boto3 to interact with CoreWeave AI Object Storage, so you can use AWS tooling against CoreWeave endpoints. We recommend using a separate [AWS profile](https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html#file-format-profile) for Object Storage to avoid conflicts with other AWS profiles and S3-compatible services. Both static credentials and [Workload Identity Federation](https://docs.coreweave.com/products/storage/object-storage/auth-access/workload-identity-federation/about.md) are supported, but we recommend Workload Identity Federation.

> [!NOTE]
>
> If you use [Workload Identity Federation](https://docs.coreweave.com/products/storage/object-storage/auth-access/workload-identity-federation/about.md), use `awscli >= 2.33.2` or `boto3 >= 1.42.5`, which incorporate a required fix for CoreWeave APIs.

## Prerequisites

Before you begin, make sure you have the following:

* An Object Storage [Access Key and Secret Key](https://docs.coreweave.com/products/storage/object-storage/auth-access/manage-access-keys/create-keys.md), or a [Workload Identity Federation](https://docs.coreweave.com/products/storage/object-storage/auth-access/workload-identity-federation/about.md) setup.
* An [organization access policy](https://docs.coreweave.com/products/storage/object-storage/auth-access/organization-policies/manage.md) that grants the `s3:` permissions you need.
* The [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), [Boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#installation), or both.
* Transport Layer Security (TLS) v1.3 support in your client and OpenSSL, which the primary endpoint, `https://cwobject.com`, requires.

## Static credentials

Static credentials are the simplest way to get started when you have an access key and secret key on hand. The same Access Key and Secret Key work with most S3-compatible clients. To set up the AWS shared configuration for Object Storage, create a `cw` profile.

1. Create a new profile and name it `cw`:

   ```bash theme={"system"}
   aws configure --profile cw
   ```

2. When prompted for information, provide the following values:

   | Field | Value |
   | - | - |
   | AWS Access Key ID | The Object Storage [Access Key](https://docs.coreweave.com/products/storage/object-storage/auth-access/manage-access-keys/create-keys.md). |
   | AWS Secret Access Key | The Object Storage Secret Key. |
   | Default region name | Optional. To set a default region, use a [CoreWeave Availability Zone](https://docs.coreweave.com/platform/regions/about-regions-and-azs.md). |
   | Default output format | Use `json` for JSON output. |

3. Set the endpoint URL to the appropriate endpoint for your use case:

   | Endpoint URL | Description |
   | - | - |
   | `https://cwobject.com` | The primary endpoint for Object Storage. Use this when running anywhere other than a CKS cluster. |
   | `http://cwlota.com` | The [LOTA endpoint](https://docs.coreweave.com/products/storage/object-storage/improving-performance/about-lota.md), which routes to the LOTA cache for best performance. Always use the LOTA endpoint from workloads running in a CKS cluster, including SUNK. |

   ```bash title="Set the primary endpoint URL" theme={"system"}
   aws configure set endpoint_url https://cwobject.com --profile cw
   ```

   ```bash title="Set the LOTA endpoint URL" theme={"system"}
   aws configure set endpoint_url http://cwlota.com --profile cw
   ```

4. Set the default addressing style to `virtual`. This is required for Object Storage.

   ```bash theme={"system"}
   aws configure set s3.addressing_style virtual --profile cw
   ```

5. To verify the connection, list your buckets. This requires the `s3:ListAllMyBuckets` permission, which [must specify `"resources": ["*"]`](https://docs.coreweave.com/products/storage/object-storage/auth-access/organization-policies/about) in your organization access policy.

   ```bash theme={"system"}
   aws s3 ls --profile cw
   ```

   If your organization has no buckets, the command prints nothing.

To skip the `--profile` flag, run `export AWS_PROFILE=cw`, or add that line to your shell configuration file.

### Use static credentials with Boto3

The Boto3 library shares the AWS CLI configuration, so `boto3.client('s3')` uses the `cw` profile when `AWS_PROFILE=cw` is set. To configure the client in code instead, set your credentials as environment variables. Replace `ACCESS_KEY_ID_VALUE` and `SECRET_ACCESS_KEY_VALUE` with your Access Key and Secret Key.

```bash theme={"system"}
export ACCESS_KEY_ID="ACCESS_KEY_ID_VALUE"
export SECRET_ACCESS_KEY="SECRET_ACCESS_KEY_VALUE"
```

Then create the client and list your buckets. Replace `US-EAST-04A` with the Availability Zone of your buckets. From workloads running in a CKS cluster, including SUNK, set `endpoint_url` to `http://cwlota.com`.

```python theme={"system"}
import os
import boto3
from botocore.client import Config

boto_config = Config(
    region_name='US-EAST-04A',
    s3={'addressing_style': 'virtual'}
)

s3 = boto3.client(
    's3',
    endpoint_url='https://cwobject.com',
    aws_access_key_id=os.environ['ACCESS_KEY_ID'],
    aws_secret_access_key=os.environ['SECRET_ACCESS_KEY'],
    config=boto_config
)

for bucket in s3.list_buckets()['Buckets']:
    print(bucket['Name'])
```

## Workload Identity Federation in Kubernetes

This approach is best for workloads running inside CKS, where short-lived tokens are preferred over long-lived static credentials. When an OIDC token is available in a file and automatically rotated (as in Kubernetes and CKS), use the [Container Credentials API](https://docs.aws.amazon.com/sdkref/latest/guide/feature-container-credentials.html). These configurations work with the AWS CLI, Boto3, and other S3 clients that use the AWS credential providers.

Start with a basic config file for the endpoints:

```bash theme={"system"}
aws configure set region US-EAST-04A --profile cw
aws configure set endpoint_url https://cwobject.com --profile cw
aws configure set s3.addressing_style virtual --profile cw
```

This produces a configuration like:

```ini theme={"system"}
[profile cw]
region = US-EAST-04A
endpoint_url = https://cwobject.com
s3 =
    addressing_style = virtual
```

Then set the Container Credentials environment variables. These are often injected automatically by the [Pod Identity Webhook](https://docs.coreweave.com/products/cks/clusters/coreweave-charts/pod-identity-webhook.md).

Replace `[ORG-ID]` with your CoreWeave organization ID.

Your **Org ID** is a short hexadecimal string (for example, `ab1cd2`). Find it on the [Settings page](https://console.coreweave.com/account/settings) of your Cloud Console account.

```bash theme={"system"}
export AWS_PROFILE=cw
export AWS_CONTAINER_CREDENTIALS_FULL_URI=https://api.coreweave.com/v1/cwobject/temporary-credentials/oidc/[ORG-ID]
export AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE=/path/to/token

aws s3 ls
```

The SDK reads the token from the file path and exchanges it for temporary credentials at the specified endpoint, then refreshes them automatically before expiry.

## Workload Identity Federation with a credential process

When you want federated credentials outside of CKS, such as on developer workstations or in CI environments, you can use a credential process. Without an auto-rotated token file, AWS SDKs support a [Process Credential Provider](https://docs.aws.amazon.com/sdkref/latest/guide/feature-process-credentials.html) that invokes a custom command to fetch credentials. This works for both human and machine workloads.

The [CoreWeave Intelligent CLI](https://github.com/coreweave/cwic) (`cwic`) provides a ready-made credential process that implements this pattern, including an on-disk cache that lets parallel processes share one credential.

For example, to exchange a CoreWeave API access token, add a line to your AWS config file (`~/.aws/config`) that invokes `cwic auth accesskey api-token`. The `cwic` command reads `COREWEAVE_API_TOKEN`, or the token stored by `cwic auth login`. Credentials are cached per token.

```ini title="Configuration for a CoreWeave API access token" highlight="4" theme={"system"}
[profile cw]
region = US-EAST-04A
endpoint_url = https://cwobject.com
credential_process = cwic auth accesskey api-token
s3 =
    addressing_style = virtual
```

For OIDC token exchange and further examples, see [Share credentials across processes](https://docs.coreweave.com/products/storage/object-storage/using-object-storage/share-credentials-across-processes.md).

### Custom script for credential process

If you want to use a custom script instead of the `cwic auth accesskey` commands, you can set the `credential_process` configuration to the path of your script. For example, if your script is in `/bin/cw-auth.sh`, you can set the `credential_process` configuration to:

```ini title="Configuration with custom script for credential process" highlight="4" theme={"system"}
[profile cw]
region = US-EAST-04A
endpoint_url = https://cwobject.com
credential_process = /bin/cw-auth.sh
s3 =
    addressing_style = virtual
```

When an S3 client invokes a command using this profile, it runs the specified script and expects output in this format:

```json title="Standard JSON output format for credentials" theme={"system"}
{
    "Version": 1,
    "AccessKeyId": "[ACCESS-KEY-ID]",
    "SecretAccessKey": "[SECRET-ACCESS-KEY]",
    "SessionToken": "[SESSION-TOKEN]",
    "Expiration": "[RFC3339-TIMESTAMP]"
}
```

The script implementation depends on your platform. It might perform an interactive browser sign-in, fetch a GitHub Actions ID token, or use another identity provider. The general pattern is:

1. Check for cached credentials.
2. Obtain a new OIDC token from your identity provider if the cached credentials are missing or expired.
3. Exchange the token with the CoreWeave API for temporary credentials.
4. Cache and return the response.

## Troubleshooting

The following table lists common errors and how to fix them.

| Error | Fix |
| - | - |
| `Could not connect to the endpoint URL` | Set `endpoint_url` to `http://cwlota.com` from workloads running in a CKS cluster, including SUNK. From anywhere else, use `https://cwobject.com`. |
| TLS handshake errors, or empty results from `cwlota.com` | Use `http://`, not `https://`, with `cwlota.com`. For `https://cwobject.com`, make sure your client and OpenSSL support TLS v1.3 (OpenSSL 1.1.1 or later). To check your version, run `openssl version`. |
| `InvalidAccessKeyId` or `SignatureDoesNotMatch` | Check that your Access Key ID and Secret Key are correct. |
| `AccessDenied` | Check that your [organization access policy](https://docs.coreweave.com/products/storage/object-storage/auth-access/organization-policies/manage.md) grants the required [S3 permissions](https://docs.coreweave.com/products/storage/object-storage/reference/object-storage-s3.md). |
| `InvalidRegion` (`Region does not match`) | When you create a bucket with Boto3 or `aws s3api create-bucket`, set `CreateBucketConfiguration.LocationConstraint` to a [CoreWeave Availability Zone](https://docs.coreweave.com/platform/regions/about-regions-and-azs.md), such as `US-EAST-04A`. Setting only the client region is insufficient. See [Create a bucket](https://docs.coreweave.com/products/storage/object-storage/buckets/manage-buckets.md#create-a-bucket). If an operation fails immediately after successful bucket creation, wait one minute and try again. |
| Requests fail even though your credentials and policy are correct | Set `s3.addressing_style` to `virtual`. Object Storage doesn't support path-style addressing. See [Set endpoints](https://docs.coreweave.com/products/storage/object-storage/using-object-storage/configure-endpoints.md). |
