1--- 2layout: "docs" 3page_title: "upstreams Stanza - Job Specification" 4sidebar_current: "docs-job-specification-upstreams" 5description: |- 6 The "upstreams" stanza allows specifying options for configuring 7 upstream services 8--- 9 10# `upstreams` Stanza 11 12<table class="table table-bordered table-striped"> 13 <tr> 14 <th width="120">Placement</th> 15 <td> 16 <code>job -> group -> service -> connect -> sidecar_service -> proxy -> **upstreams** </code> 17 </td> 18 </tr> 19</table> 20 21The `upstreams` stanza allows configuring various options for managing upstream 22services that a [Consul 23Connect](/guides/integrations/consul-connect/index.html) proxy routes to. It 24is valid only within the context of a `proxy` stanza. 25 26For Consul-specific details see the [Consul Connect 27Guide](https://learn.hashicorp.com/consul/getting-started/connect#register-a-dependent-service-and-proxy). 28 29```hcl 30job "countdash" { 31 datacenters = ["dc1"] 32 33 group "dashboard" { 34 network { 35 mode = "bridge" 36 37 port "http" { 38 static = 9002 39 to = 9002 40 } 41 } 42 43 service { 44 name = "count-dashboard" 45 port = "9002" 46 47 connect { 48 sidecar_service { 49 proxy { 50 upstreams { 51 destination_name = "count-api" 52 local_bind_port = 8080 53 } 54 } 55 } 56 } 57 } 58 59 task "dashboard" { 60 driver = "docker" 61 62 env { 63 COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}" 64 } 65 66 config { 67 image = "hashicorpnomad/counter-dashboard:v1" 68 } 69 } 70 } 71} 72 73``` 74 75## `upstreams` Parameters 76 77- `destination_name` `(string: <required>)` - Name of the upstream service. 78- `local_bind_port` - `(int: <required>)` - The port the proxy will receive 79 connections for the upstream on. 80 81The `NOMAD_UPSTREAM_ADDR_<destination_name>` environment variables may be used 82to interpolate the upstream's `host:port` address. 83 84Applications are encouraged to connect to `127.0.0.1` and a well defined port 85(eg 6379 for Redis) by default. Then when using Consul Connect the application 86can be deployed with the Redis upstream's `local_bind_port = 6379` and require 87no explicit configuration. 88 89## `upstreams` Examples 90 91The following example is an upstream config with the name of the destination service 92and a local bind port. 93 94```hcl 95 upstreams { 96 destination_name = "count-api" 97 local_bind_port = 8080 98 } 99 ``` 100 101[job]: /docs/job-specification/job.html "Nomad job Job Specification" 102[group]: /docs/job-specification/group.html "Nomad group Job Specification" 103[task]: /docs/job-specification/task.html "Nomad task Job Specification" 104[interpolation]: /docs/runtime/interpolation.html "Nomad interpolation" 105[sidecar_service]: /docs/job-specification/sidecar_service.html "Nomad sidecar service Specification" 106[upstreams]: /docs/job-specification/upstreams.html "Nomad upstream config Specification" 107