> For the complete documentation index, see [llms.txt](https://docs.slingdata.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.slingdata.io/connections/file-connections/s3.md).

# AWS S3

## Setup

The following credentials keys are accepted:

* `bucket` **(required)**
* `use_environment` (optional) -> whether to use the AWS environment variables to access. Accepts `true` or `false`.
* `profile` (optional) (or provide environment variable `AWS_PROFILE`)
* `access_key_id` (optional) (or provide environment variable `AWS_ACCESS_KEY_ID`)
* `secret_access_key` (optional) (or provide environment variable `AWS_SECRET_ACCESS_KEY`)
* `session_token` (optional) (or provide environment variable `AWS_SESSION_TOKEN`)
* `region` (optional) (or provide environment variable `AWS_REGION`)
* `endpoint` (optional) (or provide environment variable `AWS_ENDPOINT`)
* `role_arn` (optional) (or provide environment variable `AWS_ROLE_ARN`)
* `anonymous` (optional) Tells to access the bucket as anonymous (set to `true`)
* `encryption_algorithm` (optional since *v1.2.15*) The server-side encryption algorithm to use. Accepts `AES256`, `aws:kms` or `aws:kms:arn`.
* `encryption_kms_key` (optional since *v1.2.15*) If `encryption_algorithm` is `aws:kms` or `aws:kms:arn`, this is the KMS key ID or ARN to use for encryption.
* `http_timeout` (optional) A deadline for the whole S3 request, including the time to read the object body. Accepts Go duration format (e.g., `30s`, `5m`, `10m30s`). Not set by default, so large objects can stream for as long as they need. Set this only to make stuck requests fail sooner. Do not set it to correct timeout errors on large files: the deadline includes the body read, so a transfer that takes longer than the value is cut off part-way.

### Using `sling conns`

Here are examples of setting a connection named `AWS_S3`. We must provide the `type=s3` property:

{% code overflow="wrap" %}

```bash
$ sling conns set AWS_S3 type=s3 bucket=sling-bucket profile=my-profile

$ sling conns set AWS_S3 type=s3 bucket=sling-bucket access_key_id=ACCESS_KEY_ID secret_access_key="SECRET_ACCESS_KEY"
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/connections/file-connections/pages/eAdVs2BHCgdr6RS8GoJC#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

In JSON/YAML format:

{% code overflow="wrap" %}

```bash
export AWS_S3='{type: s3, bucket: sling-bucket, access_key_id: ACCESS_KEY_ID, secret_access_key: "SECRET_ACCESS_KEY"}'

export AWS_S3='{type: s3, bucket: sling-bucket, profile: my-profile}'

# or via AWS classic environment variables
export AWS_ACCESS_KEY_ID='<aws_access_key_id>'
export AWS_SECRET_ACCESS_KEY='<aws_secret_access_key>'
export AWS_SESSION_TOKEN='<aws_session_token>'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/connections/file-connections/pages/eAdVs2BHCgdr6RS8GoJC#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  AWS_S3:
    type: s3
    bucket: <bucket>
    profile: <my-profile>

  AWS_S3_OTHER:
    type: s3
    bucket: <bucket>
    access_key_id: <access_key_id>
    secret_access_key: '<secret_access_key>'
    http_timeout: 5m  # fail a stuck request after 5m. covers the body read, so
                      # keep it above the time your largest object needs
```

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.slingdata.io/connections/file-connections/s3.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
