github.com/quite/nomad@v0.8.6/website/source/docs/agent/cloud_auto_join.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Cloud Auto-join" 4 sidebar_current: "docs-agent-cloud-auto-join" 5 description: |- 6 Nomad supports automatic cluster joining using cloud metadata from various cloud providers 7 --- 8 9 # Cloud Auto-joining 10 11 As of Nomad 0.8.4, 12 [`retry_join`](/docs/agent/configuration/server_join.html#retry_join) accepts a 13 unified interface using the 14 [go-discover](https://github.com/hashicorp/go-discover) library for doing 15 automatic cluster joining using cloud metadata. To use retry-join with a 16 supported cloud provider, specify the configuration on the command line or 17 configuration file as a `key=value key=value ...` string. 18 19 Values are taken literally and must not be URL 20 encoded. If the values contain spaces, backslashes or double quotes then 21 they need to be double quoted and the usual escaping rules apply. 22 23 ```json 24 { 25 "retry_join": ["provider=my-cloud config=val config2=\"some other val\" ..."] 26 } 27 ``` 28 29 The cloud provider-specific configurations are detailed below. This can be 30 combined with static IP or DNS addresses or even multiple configurations 31 for different providers. 32 33 In order to use discovery behind a proxy, you will need to set 34 `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` environment variables per 35 [Golang `net/http` library](https://golang.org/pkg/net/http/#ProxyFromEnvironment). 36 37 The following sections give the options specific to a subset of supported cloud 38 provider. For information on all providers, see further documentation in 39 [go-discover](https://github.com/hashicorp/go-discover). 40 41 ### Amazon EC2 42 43 This returns the first private IP address of all servers in the given 44 region which have the given `tag_key` and `tag_value`. 45 46 47 ```json 48 { 49 "retry_join": ["provider=aws tag_key=... tag_value=..."] 50 } 51 ``` 52 53 - `provider` (required) - the name of the provider ("aws" in this case). 54 - `tag_key` (required) - the key of the tag to auto-join on. 55 - `tag_value` (required) - the value of the tag to auto-join on. 56 - `region` (optional) - the AWS region to authenticate in. 57 - `addr_type` (optional) - the type of address to discover: `private_v4`, `public_v4`, `public_v6`. Default is `private_v4`. (>= 1.0) 58 - `access_key_id` (optional) - the AWS access key for authentication (see below for more information about authenticating). 59 - `secret_access_key` (optional) - the AWS secret access key for authentication (see below for more information about authenticating). 60 61 #### Authentication & Precedence 62 63 - Static credentials `access_key_id=... secret_access_key=...` 64 - Environment variables (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`) 65 - Shared credentials file (`~/.aws/credentials` or the path specified by `AWS_SHARED_CREDENTIALS_FILE`) 66 - ECS task role metadata (container-specific). 67 - EC2 instance role metadata. 68 69 The only required IAM permission is `ec2:DescribeInstances`, and it is 70 recommended that you make a dedicated key used only for auto-joining. If the 71 region is omitted it will be discovered through the local instance's [EC2 72 metadata 73 endpoint](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html). 74 75 ### Microsoft Azure 76 77 This returns the first private IP address of all servers in the given region 78 which have the given `tag_key` and `tag_value` in the tenant and subscription, or in 79 the given `resource_group` of a `vm_scale_set` for Virtual Machine Scale Sets. 80 81 82 ```json 83 { 84 "retry_join": ["provider=azure tag_name=... tag_value=... tenant_id=... client_id=... subscription_id=... secret_access_key=..."] 85 } 86 ``` 87 88 - `provider` (required) - the name of the provider ("azure" in this case). 89 - `tenant_id` (required) - the tenant to join machines in. 90 - `client_id` (required) - the client to authenticate with. 91 - `secret_access_key` (required) - the secret client key. 92 93 Use these configuration parameters when using tags: 94 - `tag_name` - the name of the tag to auto-join on. 95 - `tag_value` - the value of the tag to auto-join on. 96 97 Use these configuration parameters when using Virtual Machine Scale Sets (Consul 1.0.3 and later): 98 - `resource_group` - the name of the resource group to filter on. 99 - `vm_scale_set` - the name of the virtual machine scale set to filter on. 100 101 When using tags the only permission needed is the `ListAll` method for `NetworkInterfaces`. When using 102 Virtual Machine Scale Sets the only role action needed is `Microsoft.Compute/virtualMachineScaleSets/*/read`. 103 104 ### Google Compute Engine 105 106 This returns the first private IP address of all servers in the given 107 project which have the given `tag_value`. 108 ``` 109 110 ```json 111 { 112 "retry_join": ["provider=gce project_name=... tag_value=..."] 113 } 114 ``` 115 116 - `provider` (required) - the name of the provider ("gce" in this case). 117 - `tag_value` (required) - the value of the tag to auto-join on. 118 - `project_name` (optional) - the name of the project to auto-join on. Discovered if not set. 119 - `zone_pattern` (optional) - the list of zones can be restricted through an RE2 compatible regular expression. If omitted, servers in all zones are returned. 120 - `credentials_file` (optional) - the credentials file for authentication. See below for more information. 121 122 #### Authentication & Precedence 123 124 - Use credentials from `credentials_file`, if provided. 125 - Use JSON file from `GOOGLE_APPLICATION_CREDENTIALS` environment variable. 126 - Use JSON file in a location known to the gcloud command-line tool. 127 - On Windows, this is `%APPDATA%/gcloud/application_default_credentials.json`. 128 - On other systems, `$HOME/.config/gcloud/application_default_credentials.json`. 129 - On Google Compute Engine, use credentials from the metadata 130 server. In this final case any provided scopes are ignored. 131 132 Discovery requires a [GCE Service 133 Account](https://cloud.google.com/compute/docs/access/service-accounts). 134 Credentials are searched using the following paths, in order of precedence. 135 136