NEW – Getting started with Elastigroup for Packet.net Bare Metal Cloud

Aharon Twizer
elastigroup
spot

Earlier this month we announced the launch of the worlds first bare metal spot market for compute capacity with our partnership with Packet.net. We here at Spotinst are very excited about this partnership, and today I would like to show you how to spin up your bare metal compute Elastigroup.

The first thing you will need to do is to configure your Packet account with Spotinst. Head over to Packet.net and create an account if you do not have one already. Follow the instructions below to get started.

1.0 Packet Project and API Token

  1. Log in to your Packet.net cloud account and click on the “Create new project” button.
  2. Name the project and click “Create Project” at the bottom right of the page.
    image-011
  3. You will be redirected to the project page, click on the “Settings” tab.
  4. Copy the project id to the clipboard and paste it into a text editor.
    image-013
  5. Next, click on “API Keys” located at the menu bar on the left side of the page. Scroll down to the bottom of the page and click on the plus sign as shown below.
    image-014
  6. Provide a desciptive name like “Spotinst Token 1”
    image-015
  7. Copy the key you just created into a text editor.

2.0 Configuring the Spotinst Integration

  1. From your Spotinst console main screen, click on “Clouds”
    image09
  2. Select, “Add a cloud”
    image10
  3. Enter a descriptive name and click “Create”
    image-003
  4. From the top right, click on the drop down as you can see below and select the name you added in the previous step.
    image03
  5. From the cloud options select “Packet.net”
    packet-cloud-config
  6. Next, simply paste in the API key that you created back in step 7 above then click “Validate”, then click “Save”. packet-cloud-config-api
  7. Click on the ellipses at the top right of the Spotinst console and click on “Settings”
    image-004
  8. Click on “API Zone” at the top of the screen
  9. Click on “API Tokens” and click on Generate to generate a new token. Provide a descriptive name like “packet token” and save the token string somewhere safe.
    auth-token

3.0 Creating your first Elastigroup on Packet.net

Currently we only support creation of Elastigroups on Packet.net via our API. In my examples below I will be using the curl command to make API calls to create the Packet Elastigroup. If you are running Windows 10 you can use the “Bash on Ubuntu on Windows” feature which is part of the anniversary update. We will be using our Packet.net API documentation for the steps below. Refer to this link for more information:  https://spotinst.atlassian.net/wiki/display/API/Create+Packet+Group

  1. Open your favorite text editor and paste in the json below. Name this file group_create.
  2. In the section labeled “projectID” replace this text with the same Packet projectID that copied into your text editor back in step 1.4 above.
    {
     "group":{
      "name": "packetSpotinstTest1",
      "capacity": {
        "minimum": 0,
        "maximum": 10,
        "target": 1
      },
      "strategy": {
        "spotPercentage": 100,
        "fallbackToOd": false
      },
      "compute": {
        "launchSpecification": {
          "operatingSystem": "coreos_stable",
          "userData": null,
          "tags": [
            "Env",
            "testspotinst"
          ],
          "hostName": "test.myapp.com"
        },
        "instanceTypes": {
          "spot": [
            "baremetal_0"
          ],
          "od": [
            "baremetal_0"
          ]
        },
        "dataCenters": [
          "ewr1",
          "ams1"
        ],
        "projectId": "e19136c3-82e9-4f40-9c50-e0791aff0fb5"
      }
    }}
  3. Now, from bash create a new variable as “TOKEN” with the token string that was generated back in step 2.9 above.
  4. TOKEN="mytokenstring123456"
  5. Now, type in the following command, make sure you are in the same directory as the json file created above.
    curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${TOKEN}" -d @group_create https://api.spotinst.io/packet/group
  6. You should see a response similar to the one below, be sure to copy the results to a text file. Be sure to write down the ID in the response which will look like “sig-dba37df2”.
    {
     "request": {
     "id": "b8fadac5-8064-4334-b391-745b71b29d6f",
     "url": "/packet/group",
     "method": "POST",
     "timestamp": "2016-11-09T10:15:19.483Z"
     },
     "response": {
     "status": {
     "code": 200,
     "message": "OK"
     },
     "kind": "spotinst:packet:group",
     "items": [
     {
     "id": "sig-dba37df2",
     "name": "packetSpotinstTest",
     "capacity": {
     "minimum": 0,
     "maximum": 10,
     "target": 1
     },
     "strategy": {
     "spotPercentage": 100,
     "onDemandCount": null,
     "fallbackToOd": false
     },
     "compute": {
     "launchSpecification": {
     "operatingSystem": "coreos_stable",
     "userData": null,
     "tags": [
     "database",
     "app"
     ],
     "hostName": "test.myapp.com"
     },
     "instanceTypes": {
     "spot": [
     "baremetal_0"
     ],
     "od": [
     "baremetal_0"
     ]
     },
     "dataCenters": [
     "ewr1",
     "ams1"
     ],
     "projectId": "e19136c3-82e9-4f40-9c50-e0791aff0fb5"
     },
     "createdAt": "2016-11-09T10:15:19.448+0000",
     "updatedAt": "2016-11-09T10:15:19.448+0000"
     }
     ],
     "count": 1
     }
    }
  7. Now go into your Packet.net console and see the newly launched instance launched by your new Elastigroup.
    image-009

Cleanup

If you would like to delete the Elastigroup that was just created enter the command below. Simply replace the Elastigroup ID with your own that you saved back in step 3.6 above.

curl -X DELETE -H "Authorization: Bearer ${TOKEN}" https://api.spotinst.io/packet/group/sig-dba37df2

Conclusion

That’s it! You are now up and running on our new Spot market for Packet.net. In the coming months we will be announcing a new UI for our Packet.net support. For now, please refer to our API documentation here for more information: https://spotinst.atlassian.net/wiki/display/API/Packet+Group+Service