Storage Transfer Service agent-based transfers support
[Cloud Storage regional endpoints](https://docs.cloud.google.com/storage/docs/regional-endpoints.md.txt). When a
Cloud Storage regional endpoint is specified, all data transfer traffic
through the agent to or from a Cloud Storage bucket remains
within that Google Cloud region. Any Cloud Storage buckets
involved in the transfer, including intermediate buckets for inter-file system
transfers, must be located in the specified region, or the transfer fails.

When a regional endpoint is not specified, the transfer agent connects to the
global endpoint, which routes traffic optimally but does not guarantee regional
confinement of the data in transit.

Regional endpoints are not supported in agentless transfers.

## Specify a regional endpoint

Endpoints are specified at the transfer agent level. The agent must be installed
using the `docker` command.

To specify a regional endpoint, use the `--gcs-api-endpoint` flag when
installing a transfer agent using `docker run`:

```
sudo docker run --ulimit memlock=64000000 -d --rm \
--volumes-from gcloud-config \
-v HOST_DIRECTORY:CONTAINER_DIRECTORY \
gcr.io/cloud-ingest/tsop-agent:latest \
--project-id=PROJECT_ID \
--hostname=$(hostname) \
--agent-pool=POOL_NAME \
--gcs-api-endpoint=storage.LOCATION.rep.googleapis.com
```

The flag accepts all Cloud Storage single regions, as well as the
`US` multi-region and the `EU` multi-region. See
[Bucket locations](https://docs.cloud.google.com/storage/docs/locations.md.txt) for a complete list.

## Regional endpoint consistency in agent pools

When specifying an agent pool for a transfer agent, be aware that
Storage Transfer Service doesn't enforce uniform regional endpoints across all agents
in that pool. This means you could inadvertently mix agents that have a specific
regional endpoint with agents that don't within the same pool; as a result, the
pool may route traffic through the global endpoint.

To ensure traffic remains within the desired region, only include agents with
the same regional endpoint in a given agent pool.