Google Compute Engineäºå§ã
ä½è¤ããã®è¬æ¼ãè´ãã¦ãããã¢ã¼ã·ã§ã³ã³ã¼ããã²ãããããã¨ã ã*1ãGCEãå°ã試ãã¦ã¿ããã¨ã«ãããä¸èº«ãè¦ãã«ãGoogle Compute Engineå ¥éãã¨ããæ¸ç±ãè²·ã£ã¦ã¿ãã®ã ãã©ããã§ã«å 容ãå¤ããªã£ã¦ããæ°ããããæ¬æ¸ã§ã¯gutilã¨ããCLIãã¼ã«ã使ã£ã¦ããã®ã ãã©ããã§ã«gutilããgcloudã¨ãããã¼ã«ã«ä¹ãæãããã¨ãæ¨å¥¨ããã¦ããã
この辺ãè¦ãªããgcloudãå«ãSDKãã¤ã³ã¹ãã¼ã«ã
$ curl https://sdk.cloud.google.com | bash
GCEã使ãããã®OAuthã®è¨å®ã®ããã«gcloud auth loginãå®è¡ãããå®è¡ããã¨åæã«ãã©ã¦ã¶ãèªè¨¼ç¨ãã¼ã¸ã«é£ã³ããããªã«ãã¦ãããã
$ gcloud auth login
Developers consoleã§ããã¸ã§ã¯ããä½ããæ©éã¤ã³ã¹ã¿ã³ã¹ãç«ã¡ä¸ãã¦ã¿ããasia-east1-cã£ã¦ã¾ã¼ã³ãããããæ±ã¢ã¸ã¢ãªã¼ã¸ã§ã³ã¯æ¯è¼çæ°ããã®ã§ãIvyBridgeã®ãµã¼ãã使ã£ã¦ããããã ãèªå® ããã ã¨pingã§50msï¼ã©ããã§å°æ¹¾ã¨èªãã ããæ¬å½ãï¼ï¼ãOSã¯CentOS 7ãé¸æãã³ãã³ãã©ã¤ã³ããå®è¡ããå ´åã¯ã次ã®ããã«ãªãã
$ gcloud compute instances create instance-1 --machine-type f1-micro --image centos-7 --zone asia-east1-c --project shaped-producer-XXX NAME ZONE MACHINE_TYPE INTERNAL_IP EXTERNAL_IP STATUS instance-1 asia-east1-c f1-micro 10.240.192.83 XXX.XXX.XXX.XXX RUNNING
ãªããé¸æå¯è½ãªã¤ã³ã¹ã¿ã³ã¹ã¿ã¤ãï¼machine-typesï¼ã¯æ¬¡ã®ã³ãã³ãã§èª¿ã¹ããã¨ãã§ãããOSã¤ã¡ã¼ã¸ã¯EC2ã»ã©é¸æè¢ã¯ãªãã
$ gcloud compute machine-types list --zone asia-east1-c --project shaped-producer-XXX NAME ZONE CPUS MEMORY_GB DEPRECATED f1-micro asia-east1-c 1 0.60 g1-small asia-east1-c 1 1.70 n1-highcpu-16 asia-east1-c 16 14.40 n1-highcpu-2 asia-east1-c 2 1.80 n1-highcpu-4 asia-east1-c 4 3.60 n1-highcpu-8 asia-east1-c 8 7.20 n1-highmem-16 asia-east1-c 16 104.00 n1-highmem-2 asia-east1-c 2 13.00 n1-highmem-4 asia-east1-c 4 26.00 n1-highmem-8 asia-east1-c 8 52.00 n1-standard-1 asia-east1-c 1 3.75 n1-standard-16 asia-east1-c 16 60.00 n1-standard-2 asia-east1-c 2 7.50 n1-standard-4 asia-east1-c 4 15.00 n1-standard-8 asia-east1-c 8 30.00
ï¼Webã³ã³ã½ã¼ã«ããï¼ã¤ã³ã¹ã¿ã³ã¹ãèµ·åããã¨ãããã·ã¥ãã¼ãã«ã¤ã³ã¹ã¿ã³ã¹ã表示ãããã®ã§ãSSHã¨ãããã¿ã³ãæ¼ããããã¨ããgcloud compute --project "shaped-producer-XXX" ssh --zone "asia-east1-c" "instance-1"ãã®ãããªæååããããã¢ãããããã®ã§ããããã¿ã¼ããã«ã«ã³ãããããSSHå ¬ééµãç»é²ãã¦ãªãå ´åã¯ãæ°ãã«çæãããããã ããã®ãããªSSHã®ã©ããã¼ã®ã»ãããã¡ã¤ã«ã転éããããã®push/pullã³ãã³ããªã©ãç¨æããã¦ããã
$ gcloud compute --project "shaped-producer-XXX" ssh --zone "asia-east1-c" "instance-1" WARNING: You do not have an SSH key for Google Compute Engine. WARNING: [/usr/bin/ssh-keygen] will be executed to generate a key. Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/oraccha/.ssh/google_compute_engine. Your public key has been saved in /Users/oraccha/.ssh/google_compute_engine.pub. The key fingerprint is: 3d:8c:58:eb:c7:6d:9a:ae:af:59:e6:db:81:d6:64:e6 [email protected] The key's randomart image is: +--[ RSA 2048]----+ | | | | | . | | o = | | . S + + | | . . X | | . B E | | B = . | | +=B.. | +-----------------+ Updated [https://www.googleapis.com/compute/v1/projects/shaped-producer-XXX]. Warning: Permanently added 'XXX.XXX.XXX.XXX' (RSA) to the list of known hosts. Saving password to keychain failed Identity added: /Users/oraccha/.ssh/google_compute_engine (/Users/oraccha/.ssh/google_compute_engine) Warning: Permanently added 'XXX.XXX.XXX.XXX' (RSA) to the list of known hosts. [oraccha@instance-1 ~]$ uname -a Linux instance-1 3.10.0-123.6.3.el7.x86_64 #1 SMP Wed Aug 6 21:12:36 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
ã¡ããã¨KVMã§åãã¦ãããããã
$ systemd-detect-virt kvm
ã¡ãã£ã¨ãããã¯ã¼ã¯å¨ããè¦ã¦ã¿ãã¨ãeth0ã«ã¯ãã©ã¤ãã¼ãã¢ãã¬ã¹ãå²ãå½ã¦ããã¦ãããããNATã§ã«ã¼ãã£ã³ã°ããã¦ããããããMTUã1460ãã¤ãã40ãã¤ãã¯ã©ãã¸è¡ã£ãã®ã§ãããããã¯ããGoogleã®SDNãAndromedaãããã¿ããªãããã¨ããããã©ã¯virtio_netã
$ ip a show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1460 qdisc pfifo_fast state UP qlen 1000 link/ether 42:01:0a:f0:c0:53 brd ff:ff:ff:ff:ff:ff inet 10.240.192.83/32 brd 10.240.192.83 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::4001:aff:fef0:c053/64 scope link valid_lft forever preferred_lft forever $ ip r default via 10.240.0.1 dev eth0 proto static metric 1024 10.240.0.1 dev eth0 proto static scope link metric 1
ã¤ã³ã¹ã¿ã³ã¹ã®çæã»åé¤ããã¡ããgcloudã³ãã³ãããæä½å¯è½ããã¨ãgcloud config set project XXXãå®è¡ãã¦ããã°ããã¡ãã¡--projectãªãã·ã§ã³ãæå®ããå¿ è¦ã¯ãªãã
$ gcloud compute instances delete instance-1 --zone asia-east1-c The following instances will be deleted. Attached disks configured to be auto-deleted will be deleted unless they are attached to any other instances. Deleting a disk is irreversible and any data on the disk will be lost. - [instance-1] in [asia-east1-c] Do you want to continue (Y/n)? Deleted [https://www.googleapis.com/compute/v1/projects/shaped-producer-XXX/zones/asia-east1-c/instances/instance-1].
確ãã«EC2ã¨æ¯è¼ããã¨ãCLIå¨ãã¯ããã§ãã¦ãããªã
- ä½è : åç©ç¤¼æ
- åºç社/ã¡ã¼ã«ã¼: KADOKAWA/ã¢ã¹ãã¼ã»ã¡ãã£ã¢ã¯ã¼ã¯ã¹
- çºå£²æ¥: 2014/07/30
- ã¡ãã£ã¢: 大åæ¬
- ãã®ååãå«ãããã° (2件) ãè¦ã
*1:https://cloud.google.com/developers/starterpack/ããããã¢ã¼ã·ã§ã³ã³ã¼ããå ¥åãããã¨ã§500 USDåç¡æã§ä½¿ããããã«ãªãã