Google Compute Engine ã便å©ã§è¯ãã£ã件
å æ¥ã®ISUCONã§ã¯ãGoogle Cloud Platformï¼ä»¥å¾GCPï¼ã®Google Compute Engineï¼ä»¥å¾GCEï¼ã使ãããããã§ããããããæ¬å½ã«ä¾¿å©ã ãªã¼ã¨ããã£ãããã§ãã
åæç»é²ã®ã¯ã¬ã¸ããããã¾ã£ã¦ãã¾ãã*1ããã°ãããããä»äºã§ã使ãããªããã£ã¦æã£ã¦ä½¿ã£ã¦ããããããã¯å¤§å±¤ä¾¿å©ã ã¨ããã£ãã®ã§ãã®ã¾ã¨ãã§ããç§ã«å¯¾ããã«ã³ãã§ãããã
ããããGCPã¨ãGCEã¨ãå ¨ç¶ååããã¼ããããªããGoogleâ¦Computeâ¦Cloudâ¦ãã¡ãããããã ã¨GCCã â¦ã
Google Compute Engineï¼GCEï¼ ã¯ããããEC2
GCEã¯ããããAWSã®EC2ã§ããEC2ãããããªã人ã¯å¤åããã«æ¥ãªãã ããããçç¥ãéãã¯æ²¢å±±ããã¾ãããä»åã¯gcloudã³ãã³ãã®åå¨ã«ã¤ãã¦æ¸ãããã*2
AWSåæ§ã«ãGCE以å¤ã«ãGCPã«ã¯Object Storageãªã©è²ã ãã£ãããªãã£ãããããã§ãããçç¥ã
gcloudãã©ã便å©ãªã®ã
ç§ã¯æ®æ®µã100å°ãµã¼ãã¼ãç«ã¦ããããäºã¯ã»ã¼ç¡ãããããã£ãä»ãããããæ©ãLinuxã¤ã³ã¹ã¿ã³ã¹ãã»ããï¼ããä¸æ¥éãããããã¢ã®ããã«éãªã¦ã§ããµã¼ãã¼ãå¿ è¦ã ï¼ããã®ãããªç¨éã§ã¯ã©ã¦ãããã使ãã¾ãã
ãã¾ã¾ã§ã¯Vultrã¨ããVPSãã¤ãã£ã¦ãã¾ããVultrã¯Vultrã§ããã便å©ãªã®ã§çããæ¯éã©ãããCLIãå«ããªäººã«ã¯Vultrã®ã»ããç°¡åãªWeb管çç»é¢*3ã§æ¸ãã®ã§æé«ã ã¨æãã¾ãâ¦ã¾ããæçµçã«ã¯sshãããã ãã
話ãããã¾ãããgcloudã³ãã³ããã¤ããã¨ã以ä¸ã®ãããªæä½ãç°¡åã«å¯è½ã§ãã
- ã¤ã³ã¹ã¿ã³ã¹ã®ä¸è¦§åå¾ãIPã¢ãã¬ã¹ã
- ã¤ã³ã¹ã¿ã³ã¹ã®èµ·åãçµäº
- ã¤ã³ã¹ã¿ã³ã¹ã¸ã®ssh
ããããªã®å¥ã«ã³ãã³ãã§ã§ããªãã¦ãããããããã¦ã§ã管çç»é¢ã§ããããããã£ã¦æãã§ããããç§ãããæã£ã¦ããã
åæè¨å®ãGCPã®ã¢ã«ã¦ã³ããä½ã£ã¦ãgcloudã³ãã³ãã®ç¨æ
- GCPã«ã¢ã«ã¦ã³ããã¤ãã£ã¦
- gcloudã³ãã³ããããã¦
- 管çç»é¢ãã²ããã¦
- ããã¸ã§ã¯ããä¸åã¤ãã
ããã辺ã¯ãããã«ãããã§ãããã®ã§ã°ã°ãããæè¿ã®ãã£ã¦ã¿ãç³»è¨äºã¯Qiitaã§æ¤ç´¢ããã¨æ©ãããããªããããã
gcloudã«ãã¾ã¼ã³ã¨ããã¸ã§ã¯ããä¿åãã¦ãã
ã¾ã¼ã³ã¯EC2ã®AZã§ããï¼èª¬æç¥ï¼ãããã¸ã§ã¯ãã¯â¦ããã¸ã§ã¯ãã§ãããAWSã«ã¯ã¹ãã¬ã¼ãã«ç¹ããæ¦å¿µã¯ç¡ãæ°ããããAMIã¯ã¢ã¯ã»ã¹ç¯å²ã®å¶éã ããAWSã§åæ§ãªå½¢ãå¿ è¦ãªããã¢ã«ã¦ã³ãããããã£ãä½ãã¨æãï¼ããã®ããªï¼ï¼ã
æ¡ä»¶æ¯ã§ã¢ã«ã¦ã³ããã¨ã£ã¡ããã£ã¦è¡æ¹ä¸æã«ãªãAWSã¨éããæ¡ä»¶çµäºæã«ããã¸ã§ã¯ãããã¼ã³ã¨ããã°ãå å ãããã¤ã³ã¹ã¿ã³ã¹ããã£ã¹ã¯ãã¹ãããã·ã§ãããEIPãå ¨é¨ã¾ãã£ã¨æ¶ãã¦ãããã®ã§ãAWSã§ããããã¤ã³ã¹ã¿ã³ã¹è½ã¨ãå¿ãã§ç ´ç£ã ï¼ï¼ï¼â¦ã¨ããªããããªã®ã¯è¯ãæ°ãããã*4
# ä¸åã ããã£ã¦ãã $ gcloud config set compute/zone asia-east1-c $ gcloud config set project-A-1
ã¤ã³ã¹ã¿ã³ã¹ãã¤ãã
ç§ã¯ã¤ã³ã¹ã¿ã³ã¹ä½ææã«gcloudã³ãã³ã使ããªããã¦ã§ãç»é¢ï¼Google Developers Console https://console.developers.google.com/ ï¼ã§ããããããã»ãã楽ã ããã
ãã ããããªãã«ãç§ãã10åä½ãµã¼ãã¼ãã¤ããå¿ è¦ã«ãã¾ãããäºãããã*5 ãããªæãGCEã§ã¯ãããããããã©ãâ¦APIãâ¦ãã¨ãèããå¿ è¦ããªãã®ã ã
管çç»é¢ãããããããå¾ãæå¾ã«Createãã¿ã³ããããã«ããã®ä¸ã®ãåçã®RESTã¾ãã¯ã³ãã³ãã©ã¤ã³ãã®ã³ãã³ãã©ã¤ã³ã®ãªã³ã¯ãã¯ãªãã¯ããã°ããªãã以ä¸ã¿ãããªã®ãåºãã§ã¯ãªããããããã³ãããã¦å®è¡ããã°ãããããã¨åãäºãã§ããï¼
gcloud compute --project "project-A-1" instances create "work" --zone " asia-east1-c" --machine-type "n1-standard-1" --network "default" --maintenance-policy "MIGRATE" --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write" --image "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/backports-debian-7-wheezy-v20150915" --boot-disk-size "10" --boot-disk-type "pd-standard" --boot-disk-device-name "work"
å¥ã«Googleãéç¥ã§ã¯ãªããããããã®ã¹ã¿ã¤ã«ã¯æ¯éå ¨ä¸çãçä¼¼ã¦æ¬²ããã
ãããã¨ãã£ã¿ã§ãã¹ãåã¨ãã ãä¿®æ£ãã¦ãããã£ã¨å®è¡ããã°ãã¤ã³ã¹ã¿ã³ã¹åãéã10åã®ãµã¼ãã¼ãç¨æãããã¨ãªã©æ飯åã ã èªååï¼ãããªãã®ã¯ä¿ºã¯ç¥ããã*6
ããã§ä¸ã¤ãã¤ã³ããæããã¨ãå¿
è¦ããªããªãããµã¼ãã¼ã¤ã³ã¹ã¿ã³ã¹ã®ååãã«ãã³ã¨ã¯ãªãã£ããããã¤ããªãæ¹ãè¯ããã¿ã¤ããããããéè¦ã ã
test-web-server-001
ã§ã¯ãªããtest
ã§ååã§ãããå¾ã§èº«ã«æã¿ã¦è§£ããèªåã¯workã¨ããã客ããã®ååã¨ãã¤ãã¦ãããã£ã¦ãããï¼æåã§ããããããªããã
ä¸è¦§ãè¦ã
ã¤ã³ã¹ã¿ã³ã¹ãä½ãã°ãããã©ã¦ã¶ãéãã¦ãã¾ããªãããã¨ã¯gcloudã³ãã³ãã®æ¹ãæ©ãããã ã
ã¤ã³ã¹ã¿ã³ã¹ä¸è¦§ãè¦ãã®ã¯ç°¡åã gcloud compute instances list ã¨ããã³ãã³ãã§ããã
$ gcloud compute instances list NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS work asia-east1-c n1-standard-1 true 10.240.0.2 104.***.***.*** RUNNING test asia-east1-c n1-standard-1 true 10.240.0.3 TERMINATED
ãã¨ãã°ããããåºåãåºãã ããããå¿ è¦ãªæ å ±ãããªããã¨ã«ããç§ãã¡ãããããã®ã¯ãã©ã¦ã¶ã§éãããã®å¤é¨IPã¨STATUSã ãããç§ã«ãããã°ãã«ã§ããJSONã§ã¯ãªããããããããªãã¦ãããããã³ããã§ããã®ã ããããã
ããããçããç°¡åã ã¨ããããã«ã¯ã³ãã³ããé·ãã¨æã£ãã ãããgcloud
ã¾ã§ãã¦ã°ããã¨ã¯tabã§è£å®ãå¹ãã®ã ããaliasãããã
alias glist="gcloud compute instances list" $ glist NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS work asia-east1-c n1-standard-1 true 10.240.0.2 104.***.***.*** RUNNING
ãã ãç§ã®ç¥ã£ã¦ãããã¹ã¼ãã¼Google Cloud Platformã¤ããããªããã³ãã§ããã¨ããã®lestrrat-sanã¯ãæä½ãã¿ã¦ããããããã¾ã£ããaliasãã¦ããªãã¦ããã¸ããã£ã¦ãªã£ãã ç§ã¯å¡äººãªã®ã§ãaliasããã£ã¨.bashrcãªã©ã«å ¥ããã
sshãã
gcloud compute ssh work
ã¨å©ãããããgsh
ã¨ãã«aliasããã°ãgsh work
ã ãã§ããã ããã
$ gcloud compute ssh work Warning: Permanently added 'xxx.xxx.xxx.xxx' (RSA) to the list of known hosts. Linux (none) 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3~bpo70+1 (2015-08-08) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Wed Sep 30 06:47:05 2015 from xx.xx.xx.xx uzulla@work:~$
ããã§ãããªãèªåã®ã¦ã¼ã¶ã¼åã§ãã°ã¤ã³ã§ããããã ã
â¦å¤å説æããªãã¨ä¼ãããªãããããã¯ã¹ã´ãã¦ãã¢ãããæåã«ãã®ã³ãã³ããå©ããæãã¯ããã¦ãµã¼ãã¼ã«uzullaã¨ããèªåã®ã¢ã«ã¦ã³ããä½ããããã®ã§ããã
ãªãã¨ãgcloudã³ãã³ãã¯ãåæã«ã¢ã«ã¦ã³ãã追å ãã¦ãsshéµãçæãã¦ãåæã«ãµã¼ãã¼ã«å ¬ééµãç»é²ãã¦ããã¾ã¤ããsudoerã«è¿½å ããã®ã ãã©ãã ã¾ãã£ããã俺ã¯ã¾ãã£ãã
ã¡ããã¨é ã ã¾ã§è¦ã人ã¯ãã¤ã³ã¹ã¿ã³ã¹ä½ææã«sshéµã¯ç»é²ã§ããäºã«æ°ä»ãã ãã*7ãããããããªãã®ã¯ã¤ãããªãã¦ããã®ã ã
ã©ãã ãæ¿çã«ï¼ãã¢ãã¯ã«ã¤ï¼ï¼ã ããï¼ï¼ï¼ rootï¼åè¿°ã®éãsudoerã«ç»é²æ¸ã¿ãªã®ã§sudo su ããã°ããï¼ï¼ ãµã¼ãã¼ã«ãäºåã«èªåãç»é²ããã¦ãããï¼ãªãã¦ãã£ããã£ã¡ããªãã®ã§ããï¼
æ£ç´ã«ãã£ã¦ã人ã«ãã£ã¦ã¯çççã«åãä»ããªãè¨è¨ã ã¨æããç§ãæåã¯ããã¤ããªãã£ãããããããã«æ £ãã¦ãã¾ãã¨â¦ããâ¦ããâ¦ã
ããä¸ã¤ã®ãã¤ã³ãã¨ãã¦ãåä¸ããã¸ã§ã¯ãã«ç»é²ããã¦ããã¦ã¼ã¶ã¼ã«ããã®æ¨©å©ããã*8ã ã¤ã¾ããèªåãåå ãã¦ããããã¸ã§ã¯ãã®GCEã®ãµã¼ãã¼ãªããã·ã¥ãã¨ã¢ã«ã¦ã³ããã§ããã®ã ï¼ãããè²´æ¹ã®å ¬ééµç»é²ãã¦ããããããã¨ããããªãã¦ããï¼ï¼ä¾¿å©ï¼ï¼ï¼æé«ï¼ï¼ï¼ï¼ãã£ã±ãã¢ãï¼ï¼ï¼ï¼
ãã®ã¢ã¼ãããªãã«ãããã¨ãã§ããã®ãããããªãããé·ã«ã¯å ¥ãã°é·ã«å¾ãã ã ãã¯ããUID:500ãwebã§â¦ãã¿ãããªããããã¯ãã¡ãªã®ã ãæ代ã¯å¤ãã£ã¦ããããããããªãã®ã ï¼è¨ãã»ã©ãï¼ï¼
è²ã ä½æ¥ãã
æ°ãæ¸ãã¾ã§ã¤ã³ã¹ã¿ã³ã¹ã使ãããçç¥ããã
çµäºãã
ä½æ¥ããããã°ã¤ã³ã¹ã¿ã³ã¹ãæ¢ããäºã«ãªããEC2åæ§ã«åæ¢ã¨åé¤ããããå½ä»¤çã«ã¯stopã¨deleteã ã ãã ãAWSã¨éãGCEã§ã¯TERMINATEã¨ããã¹ãã¼ã¿ã¹ã¯STOPã¨ããæå³ãããã ã©ã¡ããè±èªçãªãã¥ã¢ã³ã¹ã¨ãã¦ãã ããã®ãã¯ç§ã«ã¯ããããªãããTERMINATEããããã®ãstartã§ããäºã«éåæã¯ããã
# stop gcloud compute instances stop work # start gcloud compute instances start work # delete Y/Nãèãããã gcloud compute instances delete work
aliasããã°ï¼ä»¥ä¸ç¥ï¼
æã§ãä»ã®VPSãã¯ã©ã¦ãã§ç§ã¯stopãã¤ãããã¨ãããã¾ããªãããªããããã©ãããã ãããªãããã¨ããæã¯ç§ã®å人çãªæè¦ãªã®ã§ç°è«ã¯èªããã
ã§ããã®gcloudã³ãã³ãã®stop/startï¼ã¨ãlistï¼ã®æ°è»½ããé常ã«ãããªï¼ã¨æã£ã¦ããã
AWSã¨æ¯è¼ã«ãªãããGCEã¯å°ãããã£ã¹ã¯ãªãstop/startãæ¬å½ã«ä¸ç¬ãªã®ã *9ãæãã¤ãã¦ãã10ã20ç§ã¨ããããããªã¼ãã¼ã§ãããIPãlistããã°ã¹ãã¨ã¨ããã
åæ¢ä¸ã¯ãã£ã¹ã¯æéã ããªã®ã§å¿è«ãå®ãã1GBããã$0.04ãªã®ã§ã10GBãªãæã«50åã¨ããããªæããå ¨ç¶é度ãå¤ããSSDã«ããã¨ä¸åã§150åãã*10
ã¨ãããã¨ã§
alias gcp='gcloud compute copy-files' alias glist='gcloud compute instances list' alias gsh='gcloud compute ssh' alias gup='gcloud compute instances start' alias gdown='gcloud compute instances stop'
å ã«è§ãããªæãã®aliasã«ãã¦ããã¨ãæ¬å½ã«æ°è»½ã«ã¤ã³ã¹ã¿ã³ã¹ãä¸ãä¸ããã¦sshã§ã·ã¥ãã¨ã¯ãã£ã¦ä½æ¥åºæ¥ã¦è¯ãã ãããåæ¢ãã¦ããã°æéã§ä¸å°ããããããã100åã¨ãã§ããã(èµ·åã§ããDiskã§ãªããã¹ãããã·ã§ããã¨ãã¦ä¿åãã¦ãããããã¯ãããã«åé¡ã«ï¼)
ãããªæ軽ãªVPS(ã§ã¯ãªãã)ã¯åãã¦ã¿ãã®ã§ã大å¤è¯ããªï¼ã¨æã£ã¦ãã®ã¨ã³ããªãæ¸ããã®ã ã£ãã
å¿è«ãä»ã®ã¯ã©ã¦ãã§ãããããã¨ãã§ããªãã¨ãã訳ã§ã¯ãªãã ãââã§ããããããã¨ããããã¼ã«ãããããã¨ããã®ã¯ã¾ããããªãã ããããããã©ã«ããå ã«è§æéããªãã®ãè¯ãã§ããã ï¼èªä½ãã¦ã«ã¹ã¿ãã¤ãºãªãã¦ãã¡ã¼ã«ãã©ã¼ã ããã¤ãããªããããªPHPerã«ã¯é¢åãªãã ãã¾ãï¼ï¼ï¼ï¼
gcloudã³ãã³ãã¯æ¬å½ã«äººã使ãã«ã¯ããåºæ¥ã¦ãã¦ããã¨ãã°è£å®ããã£ãããå®è¡ãåæçãªã®ãå®éã«ä½¿ãã¨è¯ããæåãã³ãã³ãã®ã¬ã¹ãã³ã¹é ããããã·ã§ã«ã«ãã©ã£ã¦ã»ããããªãã¦æã£ã¦ããããCLIã ãã§æä½ãããªãåæã§å®è¡ã®çµæããããæ¹ãå©ããã®ã *11ã
ä½è«ã§å¤æ®µ
GCEã¯ãæ¿çã«å®ãã¨ãããã¨ã¯ãªãï¼$300ã®åæã¯ã¼ãã³ã¯ã¹ã´ã¤ãï¼ãAWSããã¯å®ãã£ã½ãããæ ¼å®VPSã®ã»ããããã«å®ããåè¿°ããVultrããIDCããã³ãã£ã¢ã®æ500åããã®ã¯ã©ã¦ãããããã¡ãã£ã¨ãã·ãªæ§è½ã§æ1000åã®Conohaã¨ãã«ã¯ããªããªãã
https://www.vultr.com/pricing/
IDCFクラウド 料金表 | クラウドならIDCフロンティア
(ã¡ãªã¿ã«ããããã®VPSã¯ãæä½å¥ç´æéããªãããã¯ã©ã¦ãã£ã½ãã¤ããããã®ã ããæ¸ããã®ã§ãããããVPSãæé¡ã§æ¯è¼ãã¦ã¯ãããªã)
ãã ãã¤ã³ã¹ã¿ã³ã¹ãããªã¨ã³ãã£ãã«ã¢ã¼ãã¨ãããã¤ãã§èµ·åããã¨ããæé·24hããèµ·åã§ããªãï¼Googleã®é½åã«ãã£ã¦ã¯ï¼åã§çµäºãããããã代ããã«ã1CPU3.75GBã¡ã¢ãªã¨ãããããã¦ãªãã·ã³ã$0.0165/hourã§ããã*12
ããã ã¨ãä»®ã«ã¤ãã£ã±ãªãã§æ1400åãããã ãããâ¦ãããå®éã«ã¯Googleãæ¯ããã«åæã«çµäºãããããã®ã§ãã¦ãã«ãªã¤ãã£ã±ãªãã§èª²éããããï¼ã¨ããäºã¯ãªãã®ã§ãããæã®ã¯ã©ã¦ãã¿ããã«ãããããªé»æºããã¡ãã¨ãã¼ã¿ãæ¶ãããã¨ãããã¨ãï¼ããã¾ã*13ï¼ãªãããsnapshotãåå¾ãã¦ãã¦ãªããã°æ®éã®ã¤ã³ã¹ã¿ã³ã¹ã«ï¼éããªã¨ã³ãã£ãã«ï¼ããäºãå¯è½ã§ããã
ã¨ã¯ãããããªã¨ã³ãã£ãã«ã¯æ¬å½ã«ã°ã£ããé»æºãã¨ãã¦ãããããéãæªãã¨ã¤ã³ã¹ã¿ã³ã¹ããããç¬éã«è½ã¡ãã®ã§ãããã«é ¼ãã®ãã©ããã¨ã¯æãã ï¼å人çã«ã¯ãã¡ãã£ã¨ãã確èªä½æ¥ãããã¹ãã¨ãã§éã«ã¤ãã£ã¦ãæãæ¨ã¦ãã¿ãããªã®ã«ã¯è¯ãï¼
ä½è« iOSã¢ããª
ãããªãã¨ããã¹ããã§ããããããããããããã¨ãã欲æ±ãçã¾ããã®ã¯å½ç¶ã ããã ã¾ããGCEã®ç®¡çç»é¢ã¯Mobile Safariãªããããªãã«æä½ã§ãããã¤ã¾ãã»ã¨ãã©ãã«æä½ããããã¨ãã§ããã£ã½ãããã ããã£ããç´°ããç»é¢ãªã®ã§ãæè¿è¦åãè¡°ãã俺ã«ã¯å¤§å¤ã§ãããã¾ã大å¤ãªã ããªãã ãã©ã
é©å½ã«ãã¯ã©ã¦ãã«ã¯ãããããã¼ã«ãªãããªããã£ã¦ãã¤ãããã¦ã¿ããããããããããã«ãããAWSã«ã¯ããããã¨èãã¦ããã¸ãããã¯ä¾¿å©ã ãªã¼ãGoogleãããããªã¼â¦ãã£ããï¼ã£ã¦ãªã£ãã
ãã¨ãã°ãGCEã¤ã³ã¹ã¿ã³ã¹ã«å¯¾ãã¦ã¯ä»¥ä¸ã®äºãã§ãã
- ã¤ã³ã¹ã¿ã³ã¹ã®ç¶æ ãè¦ã
- ã¤ã³ã¹ã¿ã³ã¹ãæ¢ãã
- ã¤ã³ã¹ã¿ã³ã¹ãèµ·åãã
- sshããï¼ï¼ï¼ï¼ *14
ãªãã¨ãããã£ã¨sshãã§ããããã®sshããã¨ãããã¤ããã¯ã便å©ã§ããããªãã¨vimããããï¼æé«ï¼ãã£ã±ãsshã®éµãèªå転éã§ä¾¿å©ï¼ï¼*15
ãã¨ãã°â¦å¤ã«å¾æ©10åã®ã¡ã·å±ã«é£¯ãé£ã¹ã«åºããã¦ãã¦ãæ¨æ¥ç§ããããªã¯ã½æ©è½ãããããªãã£ã¦æ¶ãããã«æ示ããç»é¢ã ãã©ãç®ã®åã®ã客æ§ãæ¯éè¦ããã£ã¦ãããã ã10å以å ã«è¦ããããã«ãã¦ãï¼ããã§ããªãã£ãã常èçã«èãã¦è²´æ¹ã®å ¨è²¬ä»»ã§å¤±æ³¨ã£ã¦ãã¨ã§åä¸åº§ã«ãã¦ããããããã®ã¨ãã¯æ©ä¼æ失ã®è³ åé¡ãã渡ããã¾ã^^ãã¿ãããªé»è©±ãããã£ã¦ããã®ãé »ç¹ã«ããäºã ããããªãã¨ã俺ã«ã¯ããã
ã¤ã¾ããã¢ã¯ã¢ã¯ããã«ãµã¼ãã¼ãèµ·åããããã¦ãã¡ãã£ã¨ããã³ãã³ãï¼git checkoutã¨ããè¨å®ç·¨éã¨ãï¼ããããã¦æ¬å½ã«ãããã¼ã§ããã
ããããªã®ã¹ããã«äºåã«sshã¯ã©ã¤ã¢ã³ãããããã°ãããããªãï¼ãã£ã¦æãããã*16ï¼ã§ãããã£ã±ãäºåã«iPhoneã«ãµã¼ãã¼æ¯ã®æ¥ç¶æ å ±ãç§å¯éµãããã¦ãããããIPãå¥ã®ç»é¢ããã³ãããã¦ããããããããã®ãããã®ã¯é¢åãªãã ãâ¦å¯ãã¦ããé ¼ãã
ã¡ãªã¿ã«ãä¸é¨ã®äººã«ã¯æ°ã«ãªãBlueToothãã¼ãã¼ã対å¿ã ãã対å¿ã¯ãã¦ããããã ããæå ã®ãã¼ãã¼ãã§ã¯ESCããCTRLãªã©ã®ã³ã³ããã¼ã·ã§ã³ãã¼ã¯ãã¾ãããããªãã£ã*17ã ã¾ããiOSã®SSHã¢ããªã¯å¤§ä½åæ§ãªã®ã§ãããããããªãã§ããâ¦*18ã
ãããªãã¨ã¹ãããããã«è½ã¨ããªãããã¤ã¹ã«ãªã£ã¦ããããã ããããããï¼ãã¨ãã°ï¼ã¿ãªããgmailã¢ããªãã¯ãã£ã¦ãæç¹ã§ãããã¨ããããããªï¼ãã£ã¯ã£ã¯ï¼ããããããï¼ï¼ï¼*19*20
ã¾ã¨ã
ç§ã便å©ããã ã¹ã´ã¤äººãããã¶ã³ãããã£ã¨ãããªãããã®ãä¸ã®ä¸ã«ã¯ãããã ãã ç§ããªãã ã£ã¦ã®ã£ã¼ï¼ï¼ã
çãªæ å ±ãå¾ ã¡ãã¦ããã¾ãã
ã«ã³ã
alias gcp='gcloud compute copy-files' alias gsh='gcloud compute ssh'
# ~/.ssh/configã«æ¸ãåºã gcloud compute config-ssh
# ssh gcloud compute ssh instance-name # https://cloud.google.com/sdk/gcloud/reference/compute/ssh gcloud compute ssh example-instance --ssh-flag="-L 13306:127.0.0.1:3306" gcloud compute ssh example-instance --ssh-flag="-gD 1080"
# scp gcloud compute copy-files instance-name:/file.tgz .
# ã¤ã³ã¹ã¿ã³ã¹ä¸è¦§ããããä¾¿å© $ gcloud compute instances list NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS hoge-name asia-east1-c n1-standard-1 true 10.240.0.4 130.211.255.216 RUNNING isucon-ubuntu-3rd asia-east1-c n1-standard-1 10.240.0.2 TERMINATED ubuntu-test asia-east1-c n1-standard-1 true 10.240.0.3 104.155.218.254 RUNNING
# ã¤ã³ã¹ã¿ã³ã¹èµ·å gcloud compute instances start instance-name gcloud compute instances stop instance-name
# ã¹ãããã·ã§ãã gcloud compute disks snapshot source-instance-name --snapshot-names snapshot-name-`date +"%Y%m%d%H%M%S"` # gcloud compute disks snapshot source-instance-name --snapshot-names isucon-ubuntu-3rd-`date +"%Y%m%d%H%M%S"` --zone asia-east1-c
# ããã©ã«ãã¾ã¼ã³ã¨ããã¸ã§ã¯ãã®æå® gcloud config set project project-id gcloud config set compute/zone asia-east1-c # è¨å®ç¢ºèª gcloud config list
# gcloud ã³ãã³ãï¼Google Cloud SDKï¼ã¤ã³ã¹ãã¼ã« # https://cloud.google.com/sdk/ $ curl https://sdk.cloud.google.com | bash $ exec -l $SHELL # Restart your shell: $ gcloud init
#ã¹ãããã·ã§ãããããµã¼ãã¼ãä½æ ## ã¾ãã¯Diskãä½æ $ gcloud compute --project "isucon-practice-1070" disks create "hoge-name" --size "10" --zone "asia-east1-c" --source-snapshot "work-20151111" --type "pd-standard" ## instance ãä½æ gcloud compute --project "isucon-practice-1070" instances create "hoge-name" --zone "asia-east1-c" --machine-type "n1-standard-1" --network "default" --no-restart-on-failure --maintenance-policy "TERMINATE" --scopes "https://www.googleapis.com/auth/cloud-platform" --tags "http-server" --disk "name=hoge-name" "device-name=hoge-name" "mode=rw" "boot=yes" "auto-delete=yes" (ãããã¯ã--preemptibleï¼å®ã代ããã«æ»ã¬ãã¤ï¼ ãã¤ããï¼
# ã¤ã³ã¹ã¿ã³ã¹åé¤ $ gcloud compute instances delete hoge-name
# éã«ã¼ããã£ã¹ã¯ä½æ https://cloud.google.com/compute/docs/disks/persistent-disks#creating_a_non-root_persistent_disk $ gcloud compute disks create --size 200GB --type pd-ssd disk-name ããã©ã«ãã§ã¯500GBã®ãã£ã¹ã¯ãä½ãããã200GB以ä¸ã ã¨ããã©ã¼ãã³ã¹ãè½ã¡ãã --type ãæå®ããªãã¨pd-standardã
*1:åæç»é²ã§ã$300ã®ã¯ã¬ã¸ããããããããããã
*2:AWSã«ãã³ãã³ããããã©ããã£ã¡ã®ã»ãã人ã使ãã«ã¯åºæ¥ãè¯ãâ¦ãããªâ¦æ°ããã
*3:AWSã«ããGCEã«ãããWebã®ç®¡çç»é¢ãçµæ§éãããVultrã¯è»½ããPrepaidã§å®å¿
*4:ããããåæ§ã®å½¢æ ã§ãããGoogle Analyticsã§ã¯â¦ã俺ã¯ãããã®æ¡ä»¶ãããã¼ãã¼ã®ã«ããªãã§å»¶ã ã¨âââãã£ã³ãã¼ã³ã¿ãããªã®ã®ã¢ã¯ã»ã¹è§£æãä¸è¦§ã«åºã¦ãããã â¦æ¤åæ¾ç½®ããã¦ãããé£çµ¡ãã¦ãã¡ã¼ã«ã¬ã¹ãªããâ¦ã¦ã¼ã§â¦ãã¿ãããªã®ã¯ãããããããªããå人ã®è¶£å³ã«ãã£ã¦å·®ããããã
*5:å¿è«ã¾ã£ãããªãµã¼ãã¼10å°ã¨ãã¯ç¡ããã©ããã®ECãµã¤ããã客ããã«ãã¢ããããããææ¥ã¾ã§ã«25å°ãããã^^ãã¿ãããªãªã¼ãã¼ãããã£ã¨å¦çåºæ¥ãã¨ãã話ã§ããã
*6:ã¡ãªã¿ã«ããã®ä¾ã¯gcloudã³ãã³ãèªä½ã«ã¯ããã®ããæ¹å¤ãããããããï¼ãã¨æå¥ãè¨ãããã®ãã¦ã±ããã¾ãåãããå ¨ç¶æå¥ã¯ãªã
*7:ããããsshéµã®æå¾ã®ãªãã·ã§ãã«é¨åãã¿ã¦ã¦ã¼ã¶ã¼åãå¤å®ããã¨ããæ¿çãªä»æ§ã
*8:å¿è«ACLã¯ãããã ããããç·¨éå¯è½ããªã©ãªãã°
*9:ã¡ãªã¿ã«ãshutdown -r nowããããã¨æ©ã
*10:ã¡ãªã¿ã«ã容éãã¤ã³ã¹ã¿ã³ã¹ã«ãã£ã¦æ§è½ãå¤ãããã¾ãAWSã§ãã«ããããªå¶éã¯ãã
*11:å®ã¯å¤±æãã¦ããã¨ãå¾®å¦ã ãããçµãã£ãããªï¼ãã¨ãæ¯å詳細ãã³ã¼ã«ããããªã
*12:æ´ã«ä¸ã®ãsmallãmicroããããã©ã常æ稼åãããªããªã誤差ã§ãã
*13:ã¡ããã¨shutdownãè¦å®æéã§ãããã°
*14:æ®å¿µãªããï¼ã¤ã³ã¹ã¿ã³ã¹ãæ°ããä½ãäºã¾ã§ã¯ã§ããªãã£ã½ã
*15:ããããæ¥æ¬èªã®å ¥åã¯ç°¡åã«ã¯ã§ããªãã£ã½ããæ®å¿µ
*16:å®éãpromptã¨ããã¤ããæå ã«ã¯å ¥ã£ã¦ããã¨ããã§ãCoda for iOSãæè¿ã»ãããã ãã©ãè©å¤ãå ¨ç¶èããã¦ããªã
*17:BTãã¤ãªãã§ãESCãªã©ã®ä¿®é£¾ãã¼ã®ãã¬ãããç»é¢ããæ¶ããªãã®ãä¸æè°ã ã£ãããç´å¾ããã£ã
*18:ãããã¸ãå®å ¨å¯¾å¿ãã¦ããSSHã¢ããªããè¯ãæãéãããã°ç¥ãããâ¦
*19:ãã®ã¢ããªãDropboxã¿ããã«ã¢ããªå ã§ãã¹ã³ã¼ãè¨å®ã§ããããã«ãªã£ã¦ããé ¼ã
*20:ãã¨ãããã¹ã³ã¼ãé£ç¶ãã¹ã§åæåãããã¨ãã¦ãããã¾ãä¿¡ç¨ãã¥ãã