of 12 /12
コマンドラインで始める SoftLayer NAKAJIMA Takaaki, May 23, 2014

コマンドラインで始める SoftLayer (May 23, 2014)

Embed Size (px)

DESCRIPTION

SoftLayer 勉強会 (May 23, 2014) にて LT したスライドです。 Slides about "Introduction to SoftLayer CLI" in Japanese at SoftLayer study (Shinagawa, Tokyo) May 23, 2014. See also http://softlayer.doorkeeper.jp/events/10880

Citation preview

Page 1: コマンドラインで始める SoftLayer (May 23, 2014)

コマンドラインで始める SoftLayerNAKAJIMA Takaaki,May 23, 2014

Page 2: コマンドラインで始める SoftLayer (May 23, 2014)

SoftLayer どう触っていますか?• ウェブ

• 旧ポータル

• 新ポータル

• モバイル

• CLI

• REST, SOAP, XML-RPC

• sl コマンド

• API: Python, Ruby, C#, …

Page 3: コマンドラインで始める SoftLayer (May 23, 2014)

REST

$ curl "https://${SL_USERNAME}:${SL_API_KEY}@api.softlayer.com/rest/v3/SoftLayer_Account.xml?objectMask=firstName;lastName;id"<?xml version="1.0"?><root> <firstName>Takaaki</firstName> <id>XXXXXX</id> <lastName>Nakajima</lastName></root>

Page 4: コマンドラインで始める SoftLayer (May 23, 2014)

Python CLI sl コマンド v3.1.0

Compute: bmc Bare Metal Cloud cci Cloud Compute Instances image Manages compute and flex images metadata Get details about this machine. Also available with 'my' and 'meta' server Hardware Bare metal servers sshkey Manage SSH keys on your account vs Virtual Servers (formerly CCIs)Networking: cdn Content Delivery Network service management dns Domain Name System firewall Firewall rule and security management globalip Global IP address

management messaging Message Queue Service rwhois RWhoIs operations ssl Manages SSL subnet Subnet ordering and management vlan Manage VLANs on your accountStorage: iscsi View iSCSI details nas View NAS details snapshot iSCSI snapshots

General: config View and edit configuration for this tool ticket Manage account tickets summary Display an overall summary of your account help Show help

4

Page 5: コマンドラインで始める SoftLayer (May 23, 2014)

$ sl help cdnusage: sl cdn [<command>] [<args>...] [options]Manage CDN accounts and configurationThe available commands are: detail Show details for a CDN account list List CDN accounts load Cache one or more files on all edge nodes origin-add Add an origin pull mapping origin-list Show origin pull mappings on a CDN account origin-remove Remove an origin pull mapping purge Purge one or more cached files from all edge nodes

Page 6: コマンドラインで始める SoftLayer (May 23, 2014)

$ sl help snapshotusage: sl snapshot [<command>] [<args>...] [options]Manage, order, delete iSCSI snapshotsThe available commands are: cancel Cancel an iSCSI snapshot create Create a snapshot of given iSCSI volume create-space Orders space for storing snapshots list List snpshots of given iSCSI restore-volume Restores volume from existing snapshotFor several commands <identifier> will be asked for.This can be the idof iSCSI volume or iSCSI snapshot.

Page 7: コマンドラインで始める SoftLayer (May 23, 2014)

$ sl help ticketusage: sl ticket [<command>] [<args>...] [options]Manages account ticketsThe available commands are: create Create a new ticket detail Output details about an ticket list List tickets update Update an existing ticket subjects List the subject IDs that can be used for ticket creation summary Give summary info about tickets

Page 8: コマンドラインで始める SoftLayer (May 23, 2014)

API Python Client$ pythonfrom SoftLayer import TicketManager, Clientclient = Client()ticket = TicketManager(client)>>> for t in ticket.list_tickets(): print("%d %s %s" % (t['id'], t['lastEditDate'], t['title']))9533798 2014-04-16T08:08:32+09:00 Virtual Server Cancellation - 04/15/149533682 2014-04-16T11:07:15+09:00 MONITORING: Network Monitor Alert9432082 2014-05-09T19:47:44+09:00 NOTIFICATION: Object Storage Service and the Heartbleed OpenSSL Vulnerability - Global - 04/09/20149397692 2014-04-09T15:07:36+09:00 Security Issue - Impact of CVE-2014-0160 in SLayer8988684 2014-03-15T12:46:28+09:00 Cloud Instance Cancellation - 03/13/148896850 2014-03-13T10:31:31+09:00 Introducing New Product Names8581498 2014-02-15T05:27:15+09:00 MONITORING: Network Monitor Alert

8

Page 9: コマンドラインで始める SoftLayer (May 23, 2014)

サンプル料金表を生成してみる

$ sl vs create --test --hostname=test --domain=example.com \ —cpu=2 --memory=2048 --os=CENTOS_LATEST --hourly:.......................................................:......:: Item : cost ::.......................................................:......:: 2 x 2.0 GHz Cores : 0.04 :: 2 GB : 0.04 :: CentOS 6.x - Minimal Install (64 bit) : 0.00 :(snipped): Total hourly cost : 0.08 ::.......................................................:......:https://github.com/ryumei/softlayer-utility/blob/master/sl-vs-prices.sh

9

Page 10: コマンドラインで始める SoftLayer (May 23, 2014)

料金表生成スクリプトOS CPU Memory Unit Price

CentOS 6.x - Minimal Install (64 bit) 1 1024 hourly 0.04CentOS 6.x - Minimal Install (64 bit) 1 2048 hourly 0.06CentOS 6.x - Minimal Install (64 bit) 1 4096 hourly 0.1CentOS 6.x - Minimal Install (64 bit) 1 6144 hourly 0.14CentOS 6.x - Minimal Install (64 bit) 1 8192 hourly 0.17CentOS 6.x - Minimal Install (64 bit) 1 12288 hourly 0.23CentOS 6.x - Minimal Install (64 bit) 1 16384 hourly 0.29CentOS 6.x - Minimal Install (64 bit) 1 32768 hourly 0.47CentOS 6.x - Minimal Install (64 bit) 1 49152 hourly 0.61CentOS 6.x - Minimal Install (64 bit) 1 65536 hourly 0.75

Page 11: コマンドラインで始める SoftLayer (May 23, 2014)

他にも• Object Storage Uploaderhttps://sldn.softlayer.com/blog/ashaw/Object-Storage-Uploader

• Configuration Finderhttps://sldn.softlayer.com/blog/hansKristian/Configuration-Finder-‒-Simplify-Your-Server-Search

Page 12: コマンドラインで始める SoftLayer (May 23, 2014)

まとめ• CLI, Python API をはじめ、一通りの利用手段は用意されています。

• XML RPC, REST を扱うことができるのなら、 いかようにも。

• リファレンスSLDN https://sldn.softlayer.comKnowledgeLayer http://knowledgelayer.softlayer.comPython API Reference http://softlayer-python.readthedocs.org/en/latest/index.html

12