## s3.s3_env()


Enter a rasterio (bundled GDAL) environment for S3-compatible storage.


Usage

``` python
s3.s3_env(path)
```


Extracts credentials and endpoint configuration from the fsspec storage options attached to `path` and applies them to rasterio for the duration of the `with` block. Requests are sent unsigned only when the path carries `anon=True`; otherwise GDAL signs them, using `key`/`secret` when present, selecting the path's named profile when configured, and falling back to boto's default credential resolver otherwise.

The session itself comes from `aws_session()`, so entering this block repeatedly for the same configuration doesn't re-resolve credentials.


## Parameters


`path: UPath`  
A UPath with `protocol="s3"` whose `storage_options` carry an optional named `profile`, fsspec/s3fs credentials (`key`, `secret`, `token`), an optional `anon` flag, an optional `client_kwargs["region_name"]`, and an optional custom `endpoint_url` (as produced by [make_s3_upath()](s3.make_s3_upath.md#freezebase.s3.make_s3_upath)).
