SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
CloudAPI
MiCloud Team: 振偉 / Simon
Got the PPT - http://goo.gl/DZH2Zp
Outline
● About API, SDK, REST
● SmartDataCenter CloudAPI
○ Connect CloudAPI
○ Machine managements
○ Machine create options
○ Cloud Analysis
● After Class
○ Create a machine with pre-install joomla
○ Give your machine a domain
API and SDK
● Application Programming Interface
○ Is a set of routines, protocols, and tools for
building software applications
● Software Development Kit
○ Is typically a set of software development tools
System code
non-standard language API
SDKSpecific programming language
REST
● Representational State Transfer
○ Resource
○ URL(Uniform Resource Locator)
○ method : POST, GET, PUT, DELETE
CloudAPI
What is CloudAPI?
CloudAPI
● We can use cloudapi to ….
○ Provision new machines (both SmartMachines and
traditional Virtual Machines)
○ Manage your account credentials
○ Create custom analytics for monitoring your
inferastructure
Connect CloudAPI - curl
● curl: linux/unix command to view http(s)
requests
● REST API - curl
○ curl -sS -k
-H 'Accept:application/json'
-H 'x-Api-version:~6.5'
-u 'account:password' https://api.micloud.
tw/charles/machines
-X GET
Data input use JSON
Sepcify the API version
Sepcify the username
and password info
API route for action
API route method
Connect CloudAPI -
Command Line Interface(CLI)
● Command line interface(CLI) - node.js SDK
○ Install node.js
○ Install smartdc: npm install smartdc -g
○ Upload your ssh key to key store and set env value
CloudAPI Version 6.5.x
Connect CloudAPI - Java SDK
● Provider: Muzee (http://www.muzee.net/)
● Github: https://github.com/qrtt1/joyent.
cloudapi
● Piece of code:
SmartDCClient client =
new SmartDCClient(
":api-server:",
":user-account:",
":key-name:",
new File(":private-key:"));
Systme.out.println(client.listDatasets());
● Node.js - the core tech of MiCloud CloudAPI
● Github: https://github.com/joyent/node-
smartdc
● Documentation: http://apidocs.joyent.
com/cloudapi/
● Installation:
$ npm install smartdc -g
● Piece of Code
Connect CloudAPI - Node.js SDK
var smartdc = require('smartdc');
var client = smartdc.createClient(...);
client.listMachines(function(err, machines) {
machines.forEach(function(m) {
console.log('Machine: ' + JSON.stringify(m, null, 2));
});
});
Management your cloud!
Initialize your environment
● Create your MiCloud account
● Generate your own ssh key:
$ ssh-keygen -t rsa
Import Key to Key Store -
The REST way / Use curl
● CreateKey (POST /:login/keys)
● curl -sS -k -H 'Accept:application/json' 
https://api.micloud.tw/$account/keys -X POST 
-H 'x-Api-version:~6.5' 
-u '$account:$password' 
-F 'key=<$publickeyPATH' 
-F 'name=$keyname’
Use your credential
Use your key path
Give key a name
PS: We will skip “-H 'x-Api-version:~6.5' -u '$account:$password'“ in the following slides,
and the “https://api.micloud.tw” will skip, too.
In this example, the api will be: [POST] /:login/keys, and will have parameters “key” and
“name” need to provide.
Import Key to Key Store - Use CLI
● smartdc ~6.5
Use CLI command: sdc-setup
select “no” to import new key
select you key file path
do export like this...
● ListKeys (GET /:login/keys)
● $ curl -sS -k -H 'Accept:application/json' 
-H 'x-Api-version:~6.5' 
-u $AUTH https://api.micloud.tw/charles/keys -X GET
Check your Key Store - curl
Check your Key Store - CLI
$ sdc-listkeys
We assump user use Java & Node.js SDK already import key...
● Account
● Regist Credit Card
● SSH Key
● Dataset:
The machine type, include OS or a
service preloaded system
● Package:
The size information of a machine,
include CPU, memory, disk size...
● Alias/Name:
The name of your machine
Before create machine
List the public dataset & packages
● $ sdc-listdatasets
ListDatasets (GET /:login/datasets)
● $ sdc-listpackages
ListPackages (GET /:login/packages)
● Tips:
○ use help to see more parameters
ex: sdc-listdatasets --help
○ check the document for more help
List Datasets Example
List Packages Example
Machine Management API - List
List Machines
● CLI:
sdc-listmachines
● REST:
ListMachines (GET /:login/machines)
Get Machine
● CLI:
sdc-getmachine [machine uuid]
● REST:
GetMachine (GET /:login/machines/:id)
List Machines under my account
Get the detail info of one machine
Machine Management API - Create
● CLI:
sdc-createmachines 
-dataset [dataset] 
-package [package] [machine alias]
● REST:
CreateMachine (POST /:login/machines)
Create a 512M SmartOSPlus64 machine
Machine Management API -
Stop & Delete a Machine
● sdc-stopmachine [machine uuid]
StopMachine (POST /:login/machines/:id?action=stop)
● sdc-deletemachine [machine uuid]
DeleteMachine (DELETE /:login/machines/:id)
Advance Use of CloudAPI -
Create a Machine with User-Script
sdc-createmachine 
--dataset "sdc:sdc:smartosplus64:3.0.7" 
--package "XS 512MB RAM (4CORE)" 
--script ./install.sh 
--tag hadoop-namenode=me
curl -k https://raw.github.
com/peihsinsu/installer/master/smartos-
standard64/install-joomla.sh | sh
The Script: ./install.sh
Specify a script file to let machine
execute after boot
Cloud Analysis - Dtrace
Dtrace -- MiCloud繼承
Joyent的雲端平台,提供
有一個進階的服務監控
方式,這是個非常進階
的狀態監控系統,原生
於Solaris Unix上,已有
Mac與SmartOS的實作
套件,亦可於MiCloud環
境上直接使用。
Cloud Analysis - Instruments 1/3
$ sdc-describeanalytics
可使用的監控模組:此
部份為所有監控項目的
大略說明
欄位說明:此部份為每
種欄位的設定說明
Cloud Analysis - Instruments 2/3
型別說明:此部份說明
於分析上定義的基本資
料型態有哪些...
可用監控設定說明: 這
個是主要監控要設定的
參考值...
Cloud Analysis - Instruments 3/3
轉換說明:此部份可以
透過IP轉換地理位置,
來進階顯示於世界地圖
上…
Cloud Analysis - Create Instrument
● 建立監控點
Cloud Analysis - Get instruments
● 取回監控值
監控的結果值,不過...這邊是整
合的數值,尚未能顯示每台主機
的個別值...
Cloud Analysis - Use decomposition
● 使用decomposition分類結果值
加入decomposition可以有
效分類結果值...
Cloud Analysis -
Get decomposition data
● 使用decomposition的取值結果
按照zonename做分類的監控數
值...
Cloud Analysis -
Use jsontool to format data
● use jsontool
透過jsontool,透過主機的uuid,
直接取出某台主機的記憶體使
用量...
END - Q&A

Contenu connexe

Tendances

Tendances (8)

PHP London Dec 2013 - Varnish - The 9 circles of hell
PHP London Dec 2013 - Varnish - The 9 circles of hellPHP London Dec 2013 - Varnish - The 9 circles of hell
PHP London Dec 2013 - Varnish - The 9 circles of hell
 
The jsdom
The jsdomThe jsdom
The jsdom
 
TDD With Typescript - Noam Katzir
TDD With Typescript - Noam KatzirTDD With Typescript - Noam Katzir
TDD With Typescript - Noam Katzir
 
Dirty - How simple is your database?
Dirty - How simple is your database?Dirty - How simple is your database?
Dirty - How simple is your database?
 
Why Grails?
Why Grails?Why Grails?
Why Grails?
 
わかった気になるgitit-0.8
わかった気になるgitit-0.8わかった気になるgitit-0.8
わかった気になるgitit-0.8
 
Home Improvement: Architecture & Kotlin
Home Improvement: Architecture & KotlinHome Improvement: Architecture & Kotlin
Home Improvement: Architecture & Kotlin
 
Tp web
Tp webTp web
Tp web
 

En vedette

De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1
ikewu83
 

En vedette (6)

De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1De 03 Introduction To V Cloud Api V1
De 03 Introduction To V Cloud Api V1
 
Cloud API introduction from Infosec 2012
Cloud API introduction from Infosec 2012Cloud API introduction from Infosec 2012
Cloud API introduction from Infosec 2012
 
V c loudapi_coffeetalk__pimplaskar_may2010
V c loudapi_coffeetalk__pimplaskar_may2010V c loudapi_coffeetalk__pimplaskar_may2010
V c loudapi_coffeetalk__pimplaskar_may2010
 
ProfitBricks-cloud-computing-2.0-webinar 5-1-13
ProfitBricks-cloud-computing-2.0-webinar 5-1-13ProfitBricks-cloud-computing-2.0-webinar 5-1-13
ProfitBricks-cloud-computing-2.0-webinar 5-1-13
 
Legacy modernization, cloud orchestration, api publishing
Legacy modernization, cloud orchestration, api publishingLegacy modernization, cloud orchestration, api publishing
Legacy modernization, cloud orchestration, api publishing
 
V sphere overview srm-your cloud-3-1-2011
V sphere overview srm-your cloud-3-1-2011V sphere overview srm-your cloud-3-1-2011
V sphere overview srm-your cloud-3-1-2011
 

Similaire à Cloud api之應用與實例

Sahana introduction to the code v2
Sahana   introduction to the code v2Sahana   introduction to the code v2
Sahana introduction to the code v2
AidIQ
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
Simon Su
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
Opersys inc.
 

Similaire à Cloud api之應用與實例 (20)

GCP - GCE, Cloud SQL, Cloud Storage, BigQuery Basic Training
GCP - GCE, Cloud SQL, Cloud Storage, BigQuery Basic TrainingGCP - GCE, Cloud SQL, Cloud Storage, BigQuery Basic Training
GCP - GCE, Cloud SQL, Cloud Storage, BigQuery Basic Training
 
New Jersey Red Hat Users Group Presentation: Provisioning anywhere
New Jersey Red Hat Users Group Presentation: Provisioning anywhereNew Jersey Red Hat Users Group Presentation: Provisioning anywhere
New Jersey Red Hat Users Group Presentation: Provisioning anywhere
 
smartdc by Ruby
smartdc by Rubysmartdc by Ruby
smartdc by Ruby
 
Tools for building your identity application
Tools for building your identity applicationTools for building your identity application
Tools for building your identity application
 
Sahana introduction to the code v2
Sahana   introduction to the code v2Sahana   introduction to the code v2
Sahana introduction to the code v2
 
Orchestration Tool Roundup - Arthur Berezin & Trammell Scruggs
Orchestration Tool Roundup - Arthur Berezin & Trammell ScruggsOrchestration Tool Roundup - Arthur Berezin & Trammell Scruggs
Orchestration Tool Roundup - Arthur Berezin & Trammell Scruggs
 
Nko workshop - node js crud & deploy
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
 
Deploying PostgreSQL on Kubernetes
Deploying PostgreSQL on KubernetesDeploying PostgreSQL on Kubernetes
Deploying PostgreSQL on Kubernetes
 
AWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp VaultAWS DevOps - Terraform, Docker, HashiCorp Vault
AWS DevOps - Terraform, Docker, HashiCorp Vault
 
Integrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache AirflowIntegrating ChatGPT with Apache Airflow
Integrating ChatGPT with Apache Airflow
 
Deploy MediaWiki usgin Fiware Lab Facilities
Deploy MediaWiki usgin Fiware Lab FacilitiesDeploy MediaWiki usgin Fiware Lab Facilities
Deploy MediaWiki usgin Fiware Lab Facilities
 
How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
 
Deploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab FacilitiesDeploy Mediawiki Using FIWARE Lab Facilities
Deploy Mediawiki Using FIWARE Lab Facilities
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
Building an analytics workflow using Apache Airflow
Building an analytics workflow using Apache AirflowBuilding an analytics workflow using Apache Airflow
Building an analytics workflow using Apache Airflow
 
Configuration Kits - DrupalCamp NYC 2021
Configuration Kits - DrupalCamp NYC 2021Configuration Kits - DrupalCamp NYC 2021
Configuration Kits - DrupalCamp NYC 2021
 
Single Sign On Across Drupal 8 - DrupalCon Global 2020
Single Sign On Across Drupal 8 - DrupalCon Global 2020Single Sign On Across Drupal 8 - DrupalCon Global 2020
Single Sign On Across Drupal 8 - DrupalCon Global 2020
 
Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 

Plus de Simon Su

Plus de Simon Su (20)

Kubernetes Basic Operation
Kubernetes Basic OperationKubernetes Basic Operation
Kubernetes Basic Operation
 
Google IoT Core 初體驗
Google IoT Core 初體驗Google IoT Core 初體驗
Google IoT Core 初體驗
 
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoTJSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
 
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
GCPUG.TW meetup #28 - GKE上運作您的k8s服務GCPUG.TW meetup #28 - GKE上運作您的k8s服務
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
 
Google Cloud Platform Special Training
Google Cloud Platform Special TrainingGoogle Cloud Platform Special Training
Google Cloud Platform Special Training
 
GCE Windows Serial Console Usage Guide
GCE Windows Serial Console Usage GuideGCE Windows Serial Console Usage Guide
GCE Windows Serial Console Usage Guide
 
GCPNext17' Extend 開始GCP了嗎?
GCPNext17' Extend   開始GCP了嗎?GCPNext17' Extend   開始GCP了嗎?
GCPNext17' Extend 開始GCP了嗎?
 
Try Cloud Spanner
Try Cloud SpannerTry Cloud Spanner
Try Cloud Spanner
 
Google Cloud Monitoring
Google Cloud MonitoringGoogle Cloud Monitoring
Google Cloud Monitoring
 
Google Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKEGoogle Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKE
 
JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
 
JCConf2016 - Dataflow Workshop Setup
JCConf2016 - Dataflow Workshop SetupJCConf2016 - Dataflow Workshop Setup
JCConf2016 - Dataflow Workshop Setup
 
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow IntroductionGCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
 
Brocade - Stingray Application Firewall
Brocade - Stingray Application FirewallBrocade - Stingray Application Firewall
Brocade - Stingray Application Firewall
 
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Google I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News UpdateGoogle I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News Update
 
IThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOpsIThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOps
 
Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3
 

Dernier

Dernier (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Cloud api之應用與實例

  • 1. CloudAPI MiCloud Team: 振偉 / Simon Got the PPT - http://goo.gl/DZH2Zp
  • 2. Outline ● About API, SDK, REST ● SmartDataCenter CloudAPI ○ Connect CloudAPI ○ Machine managements ○ Machine create options ○ Cloud Analysis ● After Class ○ Create a machine with pre-install joomla ○ Give your machine a domain
  • 3. API and SDK ● Application Programming Interface ○ Is a set of routines, protocols, and tools for building software applications ● Software Development Kit ○ Is typically a set of software development tools System code non-standard language API SDKSpecific programming language
  • 4. REST ● Representational State Transfer ○ Resource ○ URL(Uniform Resource Locator) ○ method : POST, GET, PUT, DELETE
  • 6. CloudAPI ● We can use cloudapi to …. ○ Provision new machines (both SmartMachines and traditional Virtual Machines) ○ Manage your account credentials ○ Create custom analytics for monitoring your inferastructure
  • 7. Connect CloudAPI - curl ● curl: linux/unix command to view http(s) requests ● REST API - curl ○ curl -sS -k -H 'Accept:application/json' -H 'x-Api-version:~6.5' -u 'account:password' https://api.micloud. tw/charles/machines -X GET Data input use JSON Sepcify the API version Sepcify the username and password info API route for action API route method
  • 8. Connect CloudAPI - Command Line Interface(CLI) ● Command line interface(CLI) - node.js SDK ○ Install node.js ○ Install smartdc: npm install smartdc -g ○ Upload your ssh key to key store and set env value CloudAPI Version 6.5.x
  • 9. Connect CloudAPI - Java SDK ● Provider: Muzee (http://www.muzee.net/) ● Github: https://github.com/qrtt1/joyent. cloudapi ● Piece of code: SmartDCClient client = new SmartDCClient( ":api-server:", ":user-account:", ":key-name:", new File(":private-key:")); Systme.out.println(client.listDatasets());
  • 10. ● Node.js - the core tech of MiCloud CloudAPI ● Github: https://github.com/joyent/node- smartdc ● Documentation: http://apidocs.joyent. com/cloudapi/ ● Installation: $ npm install smartdc -g ● Piece of Code Connect CloudAPI - Node.js SDK var smartdc = require('smartdc'); var client = smartdc.createClient(...); client.listMachines(function(err, machines) { machines.forEach(function(m) { console.log('Machine: ' + JSON.stringify(m, null, 2)); }); });
  • 12. Initialize your environment ● Create your MiCloud account ● Generate your own ssh key: $ ssh-keygen -t rsa
  • 13. Import Key to Key Store - The REST way / Use curl ● CreateKey (POST /:login/keys) ● curl -sS -k -H 'Accept:application/json' https://api.micloud.tw/$account/keys -X POST -H 'x-Api-version:~6.5' -u '$account:$password' -F 'key=<$publickeyPATH' -F 'name=$keyname’ Use your credential Use your key path Give key a name PS: We will skip “-H 'x-Api-version:~6.5' -u '$account:$password'“ in the following slides, and the “https://api.micloud.tw” will skip, too. In this example, the api will be: [POST] /:login/keys, and will have parameters “key” and “name” need to provide.
  • 14. Import Key to Key Store - Use CLI ● smartdc ~6.5 Use CLI command: sdc-setup select “no” to import new key select you key file path do export like this...
  • 15. ● ListKeys (GET /:login/keys) ● $ curl -sS -k -H 'Accept:application/json' -H 'x-Api-version:~6.5' -u $AUTH https://api.micloud.tw/charles/keys -X GET Check your Key Store - curl
  • 16. Check your Key Store - CLI $ sdc-listkeys
  • 17. We assump user use Java & Node.js SDK already import key...
  • 18. ● Account ● Regist Credit Card ● SSH Key ● Dataset: The machine type, include OS or a service preloaded system ● Package: The size information of a machine, include CPU, memory, disk size... ● Alias/Name: The name of your machine Before create machine
  • 19. List the public dataset & packages ● $ sdc-listdatasets ListDatasets (GET /:login/datasets) ● $ sdc-listpackages ListPackages (GET /:login/packages) ● Tips: ○ use help to see more parameters ex: sdc-listdatasets --help ○ check the document for more help
  • 22. Machine Management API - List List Machines ● CLI: sdc-listmachines ● REST: ListMachines (GET /:login/machines) Get Machine ● CLI: sdc-getmachine [machine uuid] ● REST: GetMachine (GET /:login/machines/:id)
  • 23. List Machines under my account
  • 24. Get the detail info of one machine
  • 25. Machine Management API - Create ● CLI: sdc-createmachines -dataset [dataset] -package [package] [machine alias] ● REST: CreateMachine (POST /:login/machines)
  • 26. Create a 512M SmartOSPlus64 machine
  • 27. Machine Management API - Stop & Delete a Machine ● sdc-stopmachine [machine uuid] StopMachine (POST /:login/machines/:id?action=stop) ● sdc-deletemachine [machine uuid] DeleteMachine (DELETE /:login/machines/:id)
  • 28. Advance Use of CloudAPI - Create a Machine with User-Script sdc-createmachine --dataset "sdc:sdc:smartosplus64:3.0.7" --package "XS 512MB RAM (4CORE)" --script ./install.sh --tag hadoop-namenode=me curl -k https://raw.github. com/peihsinsu/installer/master/smartos- standard64/install-joomla.sh | sh The Script: ./install.sh Specify a script file to let machine execute after boot
  • 29. Cloud Analysis - Dtrace Dtrace -- MiCloud繼承 Joyent的雲端平台,提供 有一個進階的服務監控 方式,這是個非常進階 的狀態監控系統,原生 於Solaris Unix上,已有 Mac與SmartOS的實作 套件,亦可於MiCloud環 境上直接使用。
  • 30. Cloud Analysis - Instruments 1/3 $ sdc-describeanalytics 可使用的監控模組:此 部份為所有監控項目的 大略說明 欄位說明:此部份為每 種欄位的設定說明
  • 31. Cloud Analysis - Instruments 2/3 型別說明:此部份說明 於分析上定義的基本資 料型態有哪些... 可用監控設定說明: 這 個是主要監控要設定的 參考值...
  • 32. Cloud Analysis - Instruments 3/3 轉換說明:此部份可以 透過IP轉換地理位置, 來進階顯示於世界地圖 上…
  • 33. Cloud Analysis - Create Instrument ● 建立監控點
  • 34. Cloud Analysis - Get instruments ● 取回監控值 監控的結果值,不過...這邊是整 合的數值,尚未能顯示每台主機 的個別值...
  • 35. Cloud Analysis - Use decomposition ● 使用decomposition分類結果值 加入decomposition可以有 效分類結果值...
  • 36. Cloud Analysis - Get decomposition data ● 使用decomposition的取值結果 按照zonename做分類的監控數 值...
  • 37. Cloud Analysis - Use jsontool to format data ● use jsontool 透過jsontool,透過主機的uuid, 直接取出某台主機的記憶體使 用量...