# `ExAws.Operation.S3`
[🔗](https://github.com/ex-aws/ex_aws/blob/v2.8.1/lib/ex_aws/operation/s3.ex#L1)

Holds data necessary for an operation on the S3 service.

## Request host

By default the bucket is placed in the request path. Two S3 config options
move it into the request host instead:

  * `virtual_host: true` - the request is sent to `<bucket>.<host>`. The
    bucket may only contain letters, digits, `.`, `-` and `_`, so the request
    always stays under the configured `host`.
  * `virtual_host: true, bucket_as_host: true` - the bucket name is used as
    the *whole* hostname (for example a CNAME pointing at a bucket).

### Security of `bucket_as_host`

With `bucket_as_host: true` whoever chooses the bucket name chooses the
server the signed request is sent to, including its body, the
`Authorization` header and any `x-amz-security-token`. A name such as
`attacker.example`, `localhost` or `169.254.169.254` is a perfectly valid
hostname, so no character check can prevent this. **Never pass an untrusted
bucket name when `bucket_as_host` is enabled.**

If bucket names are not fully under your control, set
`bucket_as_host_allowlist` to the hostnames you trust. Any other bucket
raises `ArgumentError` before a request is built:

    config :ex_aws, :s3,
      virtual_host: true,
      bucket_as_host: true,
      bucket_as_host_allowlist: ["assets.example.com", "media.example.com"]

Hostnames are compared case-insensitively. When the option is not set, any
syntactically valid hostname is accepted.

# `t`

```elixir
@type t() :: %ExAws.Operation.S3{
  body: term(),
  bucket: term(),
  headers: term(),
  http_method: term(),
  params: term(),
  parser: term(),
  path: term(),
  resource: term(),
  service: term(),
  stream_builder: term()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
