github.com/smintz/nomad@v0.8.3/website/source/docs/job-specification/resources.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "resources Stanza - Job Specification" 4 sidebar_current: "docs-job-specification-resources" 5 description: |- 6 The "resources" stanza describes the requirements a task needs to execute. 7 Resource requirements include memory, network, cpu, and more. 8 --- 9 10 # `resources` Stanza 11 12 <table class="table table-bordered table-striped"> 13 <tr> 14 <th width="120">Placement</th> 15 <td> 16 <code>job -> group -> task -> **resources**</code> 17 </td> 18 </tr> 19 </table> 20 21 The `resources` stanza describes the requirements a task needs to execute. 22 Resource requirements include memory, network, CPU, and more. 23 24 ```hcl 25 job "docs" { 26 group "example" { 27 task "server" { 28 resources { 29 cpu = 100 30 memory = 256 31 32 network { 33 mbits = 100 34 port "http" {} 35 port "ssh" { 36 static = 22 37 } 38 } 39 } 40 } 41 } 42 } 43 ``` 44 45 ## `resources` Parameters 46 47 - `cpu` `(int: 100)` - Specifies the CPU required to run this task in MHz. 48 49 - `iops` `(int: 0)` - Specifies the number of IOPS required given as a weight 50 between 0-1000. 51 52 - `memory` `(int: 300)` - Specifies the memory required in MB 53 54 - `network` <code>([Network][]: <required>)</code> - Specifies the network 55 requirements, including static and dynamic port allocations. 56 57 ## `resources` Examples 58 59 The following examples only show the `resources` stanzas. Remember that the 60 `resources` stanza is only valid in the placements listed above. 61 62 ### Memory 63 64 This example specifies the task requires 2 GB of RAM to operate. 2 GB is the 65 equivalent of 2000 MB: 66 67 ```hcl 68 resources { 69 memory = 2000 70 } 71 ``` 72 73 ### Network 74 75 This example shows network constraints as specified in the [network][] stanza 76 which require 1 Gbit of bandwidth, dynamically allocates two ports, and 77 statically allocates one port: 78 79 ```hcl 80 resources { 81 network { 82 mbits = 1000 83 port "http" {} 84 port "https" {} 85 port "lb" { 86 static = "8889" 87 } 88 } 89 } 90 ``` 91 92 [network]: /docs/job-specification/network.html "Nomad network Job Specification"