fbpx

1. Create an Elastigroup

  1.  Set target and minimum capacity to 0, and maximum capacity to be high enough for testing the scaling. example: 100
  2. Choose the instance types that to use with the Elastigroup
  3. Choose the custom AMI that works with the Host Factory master compute hosts
  4. Choose the same security groups and subnets as the master
  5. Set the key-pair file

2. Configure the Host Factory Spotinst Provider

  1. In the ${EGO_ESRVDIR}/hostfactory/conf/providers/ directory, create a spotinst directory and inside of spotinst create a conf directory:

    mkdir -p ${EGO_ESRVDIR}/hostfactory/conf/providers/spotinst/conf
  2. Inside of conf directory createspotinstprov_config.json with the following content

    {
        "SPOTINST_CREDENTIAL_FILE": "/path/to/credentials.json",
        "SPOTINST_BASE_URL": "https://api.spotinst.io"
    }

  3. Create also the following file spotinstprov_templates.json

    {
       "templates": [
            {
                "templateId": "Template-VM-SYMA",
                "attributes": {
                    "type": ["String", "X86_64"],
                    "ncores": ["Numeric", "1"],
                    "ncpus": ["Numeric", "1"],
                    "nram": ["Numeric", "1024"]
                },
                "groupId": "sig-123abcde"
            }
        ]
    }

     

    The groupId field should be set to the id of the previously created Elastigroup

  4. The credentials file specified in spotinstprov_config.json should have the following structure:

    {
      "spotinst_account_id":"...",
      "spotinst_token": "..."
    }
    

     

  5. Download the provider and supporting scripts
    1. Download: https://spotinst-public.s3.amazonaws.com/integrations/hpc/ibmsym/provider/SpotinstTool.jar
    2. Place SpotinstTool.jar in: ${EGO_TOP}/3.7/hostfactory/providers/spotinst/lib directory
    3. Ensure SpotinstTool.jar is executable:

      chmod 755 SpotinstTool.jar

       

  6. Download postprovision and sym scripts:
    1. Extract the following into: $EGO_TOP/$EGO_VERSION/hostfactory/providers/spotinst/

      postprovision:  https://spotinst-public.s3.amazonaws.com/integrations/hpc/ibmsym/provider/postprovision.tar.gz

      scripts: https://spotinst-public.s3.amazonaws.com/integrations/hpc/ibmsym/provider/scripts.tar.gz

  7. Inside of the ${EGO_ESRVDIR}/hostfactory/conf/providers/ directory, modify the hostProviders.json file, add Spotinst as a provider

    {
    
          "name": "spotinst",
    
           "enabled": 1,
    
           "confPath": "${HF_CONFDIR}/providers/spotinst/conf/",
    
           "scriptPath": "${HF_TOP}/providers/spotinst/scripts/"
    
     }

     

  8. Inside of the ${EGO_ESRVDIR}/hostfactory/conf/requestors/ directory, modify the hostRequestors.json file to add the Spotinst as a provide

    {
    
              "name": "symA",
    
                "confPath": "${HF_CONFDIR}/requestors/symA/conf/",
    
                "scriptPath": "${HF_TOP}/requestors/symA/scripts/",
    
                "enabled": 1,
    
                "needEGOCredential": 1,
    
                "providers": [ "spotinst" ],
    
                "requestMode": "POLL"
    
            },
    
            {
    
                "name": "admin",
    
                "enabled": 1,
    
                "providers": ["aws","azure","ibmcloud","spotinst"],
    
                "requestMode": "REST"
    
            },
    
            {
    
                "name": "cwsA",
    
                "confPath": "${HF_CONFDIR}/requestors/cws/",
    
                "scriptPath": "${HF_TOP}/requestors/cws/scripts/",
    
                "enabled": 1,
    
                "needEGOCredential": 1,
    
                "providers": [ "spotinst" ],
    
                "requestMode": "POLL"
    
            }

     

  9. Set the log level to LOG_DEBUG

    Modify it in the hostfactoryconf.json file inside of the $EGO_ESRVDIR/hostfactory/conf directory.

  10. Restart the host factory
    egosh service stop HostFactory
    egosh service start HostFactory