EC will automatically spin-up and spin-down VM instances according to the parameters set by you.
Env vars:
# SSH Keys to connect to workers with
GCE_SSH_PUB
GCE_SSH_PRIV
# Broker to connect to
BROKER_URL
# max count of VMs
GCE_MAX
# min count of VMs
GCE_MIN
# How many checks resulting in a node being not-busy before shrink is called
GCE_SHRINK_SENSITIVITY
# How many checks resulting in all nodes being busy before expand is called
GCE_EXPAND_SENSITIVITY
GCE_IMAGE_NAME
GCE_USE_GPUS
GCE_VM_SIZE
GCE_DATACENTER
# Actual JSON data in place of the file, this takes priority
GCE_SERVICE_ACCOUNT_KEY
# File path for GCE account json data
GCE_SERVICE_ACCOUNT_FILE
The necessary Python packages are contained in the requirements.txt file. Install them into your environment with the following command.
pip install -r requirements.txt
In order to use the Google Compute Engine ( GCE ) provider, you must create a Google Cloud account. After creating account, you must create a service account. Instructions for creating a service account follow.
- Open the Google Cloud Console.
- Click the Navigation Menu at the top-left of the console window.
- In the Navigation Menu, click IAM & Admin -> Service Accounts.
- Near the banner at the top of the window, click + CREATE SERVICE ACCOUNT.
- Enter your personal details. These are not critical to the Elastic Cloud tool.
- Click CREATE.
- Grant the service account Project -> Owner permissions.
- Grant your user account email permissions to use and administer the service account ( Enter your email into both the user and admin fields ).
- Click + CREATE KEY.
- Choose the JSON option and click CREATE. This will automatically download your service account key.
- Move this key into your local
ElasticCloud/service_account/
directory. You may change the name to anything you like, but be sure the extension is still .json. - Copy
cloud_config/sample_config.yaml
to the name,cloud_config/config.yaml
. - Open
cloud_config/config.yaml
in your favorite text editor and change theservice_account_file:
key fromservice_account/test_service_account_key.json
toservice_account/your_chosen_key_name.json
.
We must create an ssh key to enable ssh access to the VMs that are instantiated by the Elastic Cloud tool. Instructions to do so follow.
- Create the ssh key
- Use the
ssh-keygen -t rsa -m PEM
command. - Name the key,
~/.ssh/GCE_rsa
.
- Use the
- Enable access with the newly-created ssh key.
- Open the Google Cloud Console.
- Navigate to the Compute Engine -> Metadata.
- Click Edit
- Scroll down to add a new key.
- Copy the contents of your public key file,
~/.ssh/GCE_rsa.pub
into the Enter entire key data field. Now your key is enabled on every instance created with this service account!