SlideShare a Scribd company logo
1 of 12
Download to read offline
ruby-smartdc




    Usage CLI and Program
Get Started with SmartDataCenter

•Create Account
 •Get a username and password.


•Customers
  http://www.joyent.com/customers/
  ‣ http://www.joyentcloud.com/
  ‣ http://z-cloud.jp/
  ‣ etc...
CLI
Install and Setup
•Install
 $ gem install smartdc
 Fetching: smartdc-0.3.0.gem (100%)
 Successfully installed smartdc-0.3.0
 1 gem installed


•Setup
 $ sdc-setup https://api.z-cloud.jp
 version:[~6.5] ~6.5
 Username (login): your name
 Password: your password
 Successful configuration.
Register to generate an SSH
•Generate
 $ ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa
 Generating public/private rsa key pair.
 ...


•Register
 $ sdc-createkey your-key ~/.ssh/id_rsa.pub
 {
     "name": "your-key",
       "key": "ssh-rsa ...",
       "created": "2011-11-06T12:43:24+00:00",
       "updated": "2011-11-06T12:43:24+00:00"
 }
Provision a new Machine
• Help
  $ sdc-createmachine -h
  Usage: sdc-createmachine [options]
    -n, --name NAME             friendly name for this machine.
    -e, --dataset URN            dataset URN.
    -p, --package NAME           Name of the package to use on provisioning.
    -h, --help
  Datasets(urn): sdc:sdc:centos6lvm:1.1.3 sdc:sdc:smartos64:1.4.7
  Packages(name): Small_1GB Medium_2GB Medium_4GB Large_8GB


• Create
  $ sdc-createmachine -n your-machine -e sdc:sdc:smartos64:1.4.7 -p Medium_2GB
  {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f",
  "name": "your-machine", "type": "smartmachine", "state": "provisioning",
  "dataset": "sdc:sdc:smartos64:1.4.7", "ips": ["210.152.137.65"],
  "memory": 2048, "disk": 61440, "metadata": {},
  "created": "2011-11-06T13:02:09+00:00",
  "updated": "2011-11-06T13:02:10+00:00"}
State of the machine
•Get
 $ sdc-getmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f
 {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f",
 "name": "your-machine",
 "type": "smartmachine",
 "state": "running",
 "dataset": "sdc:sdc:smartos64:1.4.7",
 "ips": ["210.152.137.65"],
 "memory": 2048,
 "disk": 61440,
 "metadata": {},
 "created": "2011-11-06T13:02:42+00:00",
 "updated": "2011-11-06T13:02:42+00:00"}
Delete the machine
• Stop
  $ sdc-stopmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f
  true
  $ sdc-getmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f
  {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f",
  ...
   "state": "stopped",


• Delete
  $ sdc-deletemachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f
  true
  $ sdc-getmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f
  {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f",
  ...
   "state": "deleted",
Program
Connect and Machine find
require 'smartdc'
config = { "url" => "https://example.com/", "version" => "~6.5",
          "username" => "auth_user","password" => "auth_pass"}


client = Smartdc.new(config)
machines = client.machines.find
machines.each do |machine|
 puts "machines id: #{machine.id}, state: #{machine.state}"
 machine = client.machines(machine.id)


 puts 'Start the machine.'
 machine.start


 puts "machine id: #{machine.read.id}, state: #{machine.read.state}"
end
Return type of the variable
# Type of a variable to mash. (Default)
client.request.return_variable = 'mash'
puts client.datacenters.find
   #=> #<Hashie::Mash example="example.com">


# Type of a variable to hash.
client.request.return_variable = 'hash'
puts client.datacenters.find
   #=> {"example"=>"https://example.com"}


# Type of a variable to json.
client.request.return_variable = 'json'
puts client.datacenters.find
   #=> {"example": "https://example.com"}
End
•RubyGems
 https://rubygems.org/gems/smartdc


•GitHub
 https://github.com/ogom/ruby-smartdc


•API documentation
 http://apidocs.joyent.com/napi/cloudapi/

More Related Content

What's hot

HTML5 Games with CreateJS
HTML5 Games with CreateJSHTML5 Games with CreateJS
HTML5 Games with CreateJSDave Kelleher
 
Solr integration in Magento Enterprise
Solr integration in Magento EnterpriseSolr integration in Magento Enterprise
Solr integration in Magento EnterpriseTobias Zander
 
NoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT TageNoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT TageAlexander Hendorf
 
Cache is King: Get the Most Bang for Your Buck From Ruby
Cache is King: Get the Most Bang for Your Buck From RubyCache is King: Get the Most Bang for Your Buck From Ruby
Cache is King: Get the Most Bang for Your Buck From RubyMolly Struve
 
MongoD Essentials
MongoD EssentialsMongoD Essentials
MongoD Essentialszahid-mian
 
DEF CON 23 - amit ashbel and maty siman - game of hacks
DEF CON 23 - amit ashbel and maty siman - game of hacks DEF CON 23 - amit ashbel and maty siman - game of hacks
DEF CON 23 - amit ashbel and maty siman - game of hacks Felipe Prado
 
watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話Kohki Miki
 
Firebase_not_really_yohoho
Firebase_not_really_yohohoFirebase_not_really_yohoho
Firebase_not_really_yohohoRoman Sachenko
 
Responsive Design with WordPress
Responsive Design with WordPressResponsive Design with WordPress
Responsive Design with WordPressJoe Casabona
 
Writing Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassWriting Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassJean-Luc David
 
PHP Cookies, Sessions and Authentication
PHP Cookies, Sessions and AuthenticationPHP Cookies, Sessions and Authentication
PHP Cookies, Sessions and AuthenticationGerard Sychay
 

What's hot (16)

Redis
RedisRedis
Redis
 
HTML5 Games with CreateJS
HTML5 Games with CreateJSHTML5 Games with CreateJS
HTML5 Games with CreateJS
 
Solr integration in Magento Enterprise
Solr integration in Magento EnterpriseSolr integration in Magento Enterprise
Solr integration in Magento Enterprise
 
Web security
Web securityWeb security
Web security
 
NoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT TageNoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
NoSQL oder: Freiheit ist nicht schmerzfrei - IT Tage
 
Cache is King: Get the Most Bang for Your Buck From Ruby
Cache is King: Get the Most Bang for Your Buck From RubyCache is King: Get the Most Bang for Your Buck From Ruby
Cache is King: Get the Most Bang for Your Buck From Ruby
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
DNSSEC FIRST
DNSSEC FIRSTDNSSEC FIRST
DNSSEC FIRST
 
Figaro
FigaroFigaro
Figaro
 
MongoD Essentials
MongoD EssentialsMongoD Essentials
MongoD Essentials
 
DEF CON 23 - amit ashbel and maty siman - game of hacks
DEF CON 23 - amit ashbel and maty siman - game of hacks DEF CON 23 - amit ashbel and maty siman - game of hacks
DEF CON 23 - amit ashbel and maty siman - game of hacks
 
watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話watchOS 2でゲーム作ってみた話
watchOS 2でゲーム作ってみた話
 
Firebase_not_really_yohoho
Firebase_not_really_yohohoFirebase_not_really_yohoho
Firebase_not_really_yohoho
 
Responsive Design with WordPress
Responsive Design with WordPressResponsive Design with WordPress
Responsive Design with WordPress
 
Writing Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassWriting Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google Glass
 
PHP Cookies, Sessions and Authentication
PHP Cookies, Sessions and AuthenticationPHP Cookies, Sessions and Authentication
PHP Cookies, Sessions and Authentication
 

Similar to smartdc by Ruby

Cloud api之應用與實例
Cloud api之應用與實例Cloud api之應用與實例
Cloud api之應用與實例Simon Su
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-apiEric Ahn
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterAndrey Kudryavtsev
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
Travis and fastlane
Travis and fastlaneTravis and fastlane
Travis and fastlaneSteven Shen
 
Oracle sharding : Installation & Configuration
Oracle sharding : Installation & ConfigurationOracle sharding : Installation & Configuration
Oracle sharding : Installation & Configurationsuresh gandhi
 
Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2Hell19
 
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...BlueHat Security Conference
 
Elk its big log season
Elk its big log seasonElk its big log season
Elk its big log seasonEric Luellen
 
Google Compute Engine Starter Guide
Google Compute Engine Starter GuideGoogle Compute Engine Starter Guide
Google Compute Engine Starter GuideSimon Su
 
Introduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceIntroduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceBo-Yi Wu
 
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloudOpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloudNetcetera
 
[Z cloud] Create Your First Smartmachine In 10min
[Z cloud] Create Your First Smartmachine In 10min[Z cloud] Create Your First Smartmachine In 10min
[Z cloud] Create Your First Smartmachine In 10minYukihiko SAWANOBORI
 
Architecting Secure and Compliant Applications with MongoDB
Architecting Secure and Compliant Applications with MongoDB        Architecting Secure and Compliant Applications with MongoDB
Architecting Secure and Compliant Applications with MongoDB MongoDB
 
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...PavelKonotopov
 

Similar to smartdc by Ruby (20)

Cloud api之應用與實例
Cloud api之應用與實例Cloud api之應用與實例
Cloud api之應用與實例
 
Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
Terraform Cosmos DB
Terraform Cosmos DBTerraform Cosmos DB
Terraform Cosmos DB
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 
Multipath
MultipathMultipath
Multipath
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Travis and fastlane
Travis and fastlaneTravis and fastlane
Travis and fastlane
 
Oracle sharding : Installation & Configuration
Oracle sharding : Installation & ConfigurationOracle sharding : Installation & Configuration
Oracle sharding : Installation & Configuration
 
Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2
 
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
 
Elk its big log season
Elk its big log seasonElk its big log season
Elk its big log season
 
Monkey man
Monkey manMonkey man
Monkey man
 
Google Compute Engine Starter Guide
Google Compute Engine Starter GuideGoogle Compute Engine Starter Guide
Google Compute Engine Starter Guide
 
Introduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceIntroduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript Conference
 
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloudOpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
OpenCloudDay 2014: Deploying trusted developer sandboxes in Amazon's cloud
 
[Z cloud] Create Your First Smartmachine In 10min
[Z cloud] Create Your First Smartmachine In 10min[Z cloud] Create Your First Smartmachine In 10min
[Z cloud] Create Your First Smartmachine In 10min
 
Architecting Secure and Compliant Applications with MongoDB
Architecting Secure and Compliant Applications with MongoDB        Architecting Secure and Compliant Applications with MongoDB
Architecting Secure and Compliant Applications with MongoDB
 
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
 
Demystifying Apple 'Pie' & TouchID
Demystifying Apple 'Pie' & TouchIDDemystifying Apple 'Pie' & TouchID
Demystifying Apple 'Pie' & TouchID
 

Recently uploaded

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

smartdc by Ruby

  • 1. ruby-smartdc Usage CLI and Program
  • 2. Get Started with SmartDataCenter •Create Account •Get a username and password. •Customers http://www.joyent.com/customers/ ‣ http://www.joyentcloud.com/ ‣ http://z-cloud.jp/ ‣ etc...
  • 3. CLI
  • 4. Install and Setup •Install $ gem install smartdc Fetching: smartdc-0.3.0.gem (100%) Successfully installed smartdc-0.3.0 1 gem installed •Setup $ sdc-setup https://api.z-cloud.jp version:[~6.5] ~6.5 Username (login): your name Password: your password Successful configuration.
  • 5. Register to generate an SSH •Generate $ ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa Generating public/private rsa key pair. ... •Register $ sdc-createkey your-key ~/.ssh/id_rsa.pub { "name": "your-key", "key": "ssh-rsa ...", "created": "2011-11-06T12:43:24+00:00", "updated": "2011-11-06T12:43:24+00:00" }
  • 6. Provision a new Machine • Help $ sdc-createmachine -h Usage: sdc-createmachine [options] -n, --name NAME friendly name for this machine. -e, --dataset URN dataset URN. -p, --package NAME Name of the package to use on provisioning. -h, --help Datasets(urn): sdc:sdc:centos6lvm:1.1.3 sdc:sdc:smartos64:1.4.7 Packages(name): Small_1GB Medium_2GB Medium_4GB Large_8GB • Create $ sdc-createmachine -n your-machine -e sdc:sdc:smartos64:1.4.7 -p Medium_2GB {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f", "name": "your-machine", "type": "smartmachine", "state": "provisioning", "dataset": "sdc:sdc:smartos64:1.4.7", "ips": ["210.152.137.65"], "memory": 2048, "disk": 61440, "metadata": {}, "created": "2011-11-06T13:02:09+00:00", "updated": "2011-11-06T13:02:10+00:00"}
  • 7. State of the machine •Get $ sdc-getmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f", "name": "your-machine", "type": "smartmachine", "state": "running", "dataset": "sdc:sdc:smartos64:1.4.7", "ips": ["210.152.137.65"], "memory": 2048, "disk": 61440, "metadata": {}, "created": "2011-11-06T13:02:42+00:00", "updated": "2011-11-06T13:02:42+00:00"}
  • 8. Delete the machine • Stop $ sdc-stopmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f true $ sdc-getmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f", ... "state": "stopped", • Delete $ sdc-deletemachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f true $ sdc-getmachine 83c2902a-0093-4ce2-8abe-3b9dd6199d8f {"id": "83c2902a-0093-4ce2-8abe-3b9dd6199d8f", ... "state": "deleted",
  • 10. Connect and Machine find require 'smartdc' config = { "url" => "https://example.com/", "version" => "~6.5", "username" => "auth_user","password" => "auth_pass"} client = Smartdc.new(config) machines = client.machines.find machines.each do |machine| puts "machines id: #{machine.id}, state: #{machine.state}" machine = client.machines(machine.id) puts 'Start the machine.' machine.start puts "machine id: #{machine.read.id}, state: #{machine.read.state}" end
  • 11. Return type of the variable # Type of a variable to mash. (Default) client.request.return_variable = 'mash' puts client.datacenters.find #=> #<Hashie::Mash example="example.com"> # Type of a variable to hash. client.request.return_variable = 'hash' puts client.datacenters.find #=> {"example"=>"https://example.com"} # Type of a variable to json. client.request.return_variable = 'json' puts client.datacenters.find #=> {"example": "https://example.com"}