LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

[RescaleAPI] クラスタ構築後のマシンへのsshログイン情報の取得

Posted at

1. クラスタ構築後のマシンへのsshログイン情報の取得

1.1 スクリプトの作成

以下のシェルスクリプトを "rescale-connectionDetails.sh" という名前で保存します。

rescale-connectionDetails.shの作成
vi ${script}/rescale-connectionDetails.sh
source
#!/bin/bash

JOB_ID=$1
TOKEN="${RESCALE_API_TOKEN}"

curl -s -H "Authorization: Token ${TOKEN}" \
https://platform.rescale.jp/api/v3/jobs/${JOB_ID}/connection_details/
実行権限付与
chmod +x ${script}/rescale-connectionDetails.sh

1.2 実行例

接続情報の取得
connectionJson=$(rescale-connectionDetails.sh ${jobId})
echo ${connectionJson} | jq .
結果例
{
  "connectionDetails": [
    {
      "workingDirectory": "/enc/ujpprod_zDQAo/work",
      "publicHostname": "ec2-13-112-186-82.ap-northeast-1.compute.amazonaws.com",
      "port": 22,
      "publicIp": "13.112.186.82",
      "host": "13.112.186.82",
      "user": "ujpprod_zDQAo",
      "privateIp": "10.28.46.243",
      "privateHostname": "ip-10-28-46-243"
    }
  ]
}
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up