近況 Twitter

2006年09月26日(火)

[] Amazon EC2

 Amazon EC2 betaのsign-upが完了したというメールがやってきた。早速やってみよう。

 Amazon EC2というのは、Amazon.comサーバが稼動しているサーバ仮想化の仕組みをそのまま外販してしまおうという、とても太っ腹なサービスで、サーバ稼動1時間あたり10セント、転送1GBあたり20セントぽっきりで使える。この他OSイメージのサイズ1GBあたり15セントかかるのと、データの保存をしたければAmazon S3を使う必要があるというのが注意点。(サーバインスタンスが止まるとローカルに保存しているデータも消える。FAQにはS3に保存するか、複数インスタンスを起動してレプリケーションしておけと書いてある)

 一ヶ月サーバを動かしたとしても72ドル。10Mbpsを一ヶ月間常時消費しても約633ドル。しめてだいたい月10万円で、Amazon.comと同じ環境サーバが動かせるなら安いものと考えることもできるだろう。


標準で用意されているOSイメージはこれだけ。

C:\temp\ec2-api-tools-1.2-5692\bin>ec2-describe-images
IMAGE   ami-5bae4b32    ec2-public-images/getting-started.manifest      206029621532    available       public
IMAGE   ami-68ae4b01    ec2-public-images/fedora-core4-base.manifest    206029621532    available       public
IMAGE   ami-69ae4b00    ec2-public-images/fedora-core4-apache-mysql.manifest 206029621532    available       public
IMAGE   ami-6dae4b04    ec2-public-images/fedora-core4-apache.manifest  206029621532    available       public
IMAGE   ami-6fae4b06    ec2-public-images/fedora-core4-mysql.manifest   206029621532    available       public

まずはSSHのキーを作る。このキーでログインする。

C:\temp\ec2-api-tools-1.2-5692\bin>ec2-add-keypair gsg-keypair 
KEYPAIR gsg-keypair  1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f 
-----BEGIN RSA PRIVATE KEY-----
(略)
-----END RSA PRIVATE KEY-----

とりあえず、ec2-public-images/fedora-core4-base.manifestを起動してみます。

C:\temp\ec2-api-tools-1.2-5692\bin>ec2-run-instances ami-68ae4b01 -k gsg-keypair

RESERVATION     r-6ac82d03      396424109257    default
INSTANCE        i-8ca541e5      ami-68ae4b01            pending gsg-keypair

起動コマンドを打ってもすぐには上がらない。(Documentにも数分待てと書いてある)


C:\temp\ec2-api-tools-1.2-5692\bin>ec2-describe-instances i-8ca541e5
RESERVATION     r-6ac82d03      396424109257    default
INSTANCE        i-8ca541e5      ami-68ae4b01            pending gsg-keypair

pending状態で結構待たされる。5分くらい待っただろうか?


C:\temp\ec2-api-tools-1.2-5692\bin>ec2-describe-instances i-8ca541e5
RESERVATION     r-6ac82d03      396424109257    default
INSTANCE        i-8ca541e5      ami-68ae4b01    domU-12-31-33-00-01-7B.usma1.compute.amazonaws.com      running gsg-keypair

おー、起動した。domUという名前から考えるとXenかな?

SSHアクセスできるように設定変更する。

C:\temp\ec2-api-tools-1.2-5692\bin>ec2-authorize default -p 22
GROUP           default
PERMISSION              default ALLOWS  tcp     22      22      FROM    CIDR   0.0.0.0/0

domU-12-31-33-00-01-A0.usma1.compute.amazonaws.comにsshアクセスしてみる


         __|  __|_  )
         _|  (     /
        ___|\___|___|

 Welcome to an EC2 Public Image
                       :-)

[root@domu-12-31-33-00-01-7b log]# ps axww
  PID TTY      STAT   TIME COMMAND
    1 ?        S      0:04 init [4]
    2 ?        S      0:00 [migration/0]
    3 ?        SN     0:00 [ksoftirqd/0]
    4 ?        S      0:00 [watchdog/0]
    5 ?        S<     0:00 [events/0]
    6 ?        S<     0:00 [khelper]
    7 ?        S<     0:00 [kthread]
    8 ?        S<     0:00 [xenwatch]
    9 ?        S<     0:00 [xenbus]
   16 ?        S<     0:00 [kblockd/0]
   39 ?        S      0:00 [pdflush]
   40 ?        S      0:00 [pdflush]
   42 ?        S<     0:00 [aio/0]
   41 ?        S      0:00 [kswapd0]
  558 ?        S<     0:00 [kseriod]
  588 ?        S      0:00 [kjournald]
  632 ?        S<s    0:00 udevd -d
  779 ?        S      0:00 [kjournald]
 1058 ?        Ss     0:00 /sbin/dhclient -1 -q -cf /etc/dhclient-eth0.conf -lf /var/lib/dhcp/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
 1097 ?        Ss     0:00 syslogd -m 0
 1099 ?        Ss     0:00 klogd -x
 1106 ?        Ss     0:00 portmap
 1123 ?        Ss     0:00 rpc.statd
 1257 ?        Ss     0:00 /usr/sbin/automount --timeout=60 /net program /etc/auto.net
 1272 ?        Ss     0:00 cupsd
 1306 ?        Ss     0:00 /usr/sbin/sshd
 1328 ?        Ss     0:00 sendmail: accepting connections
 1337 ?        Ss     0:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
 1351 ?        Ss     0:00 crond
 1358 ?        SNs    0:00 anacron -s
 1365 ?        Ss     0:00 /usr/sbin/atd
 1372 ?        Ss     0:00 dbus-daemon --system
 1381 ?        Ss     0:00 hald --retain-privileges
 1402 tty1     Ss+    0:00 /sbin/mingetty tty1
 1403 tty2     Ss+    0:00 /sbin/mingetty tty2
 1404 tty3     Ss+    0:00 /sbin/mingetty tty3
 1405 tty4     Ss+    0:00 /sbin/mingetty tty4
 1406 tty5     Ss+    0:00 /sbin/mingetty tty5
 1407 tty6     Ss+    0:00 /sbin/mingetty tty6
 1408 ?        Rs     0:00 sshd: root@pts/0
 1416 pts/0    Ss     0:00 -bash
 1473 pts/0    R+     0:00 ps axww
[root@domu-12-31-33-00-01-7b ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             10321208    777028   9019892   8% /
none                    870472         0    870472   0% /dev/shm
/dev/sda2            153915428    192676 145904308   1% /mnt
[root@domu-12-31-33-00-01-7b ~]# uname -a
Linux domu-12-31-33-00-01-7b.usma1.compute.amazonaws.com 2.6.16-xenU #1 SMP Mon Aug 14 19:11:10 SAST 2006 i686 athlon i386 GNU/Linux
[root@domu-12-31-33-00-01-7b ~]# dmesg
Linux version 2.6.16-xenU (builder@patchbat.amazonsa) (gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)) #1 SMP Mon Aug 14 19:11:10 SAST 2006
BIOS-provided physical RAM map:
 Xen: 0000000000000000 - 000000006a400000 (usable)
980MB HIGHMEM available.
727MB LOWMEM available.
NX (Execute Disable) protection: active
On node 0 totalpages: 437248
  DMA zone: 186366 pages, LIFO batch:31
  DMA32 zone: 0 pages, LIFO batch:0
  Normal zone: 0 pages, LIFO batch:0
  HighMem zone: 250882 pages, LIFO batch:31
IRQ lockup detection disabled
Built 1 zonelists
Kernel command line:  root=/dev/sda1 ro 4
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
PID hash table entries: 4096 (order: 12, 65536 bytes)
Xen reported: 2405.448 MHz processor.
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Software IO TLB disabled
vmalloc area: ee000000-f53fe000, maxmem 2d7fe000
Memory: 1718700k/1748992k available (1958k kernel code, 20948k reserved, 620k data, 144k init, 1003528k highmem)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay using timer specific routine.. 4813.88 BogoMIPS (lpj=24069429)
Mount-cache hash table entries: 512
CPU: After generic identify, caps: 078bc3f1 e3d3fbff 00000000 00000000 00000001 00000000 00000001
CPU: After vendor identify, caps: 078bc3f1 e3d3fbff 00000000 00000000 00000001 00000000 00000001
CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
CPU: L2 Cache: 1024K (64 bytes/line)
CPU: After all inits, caps: 078bc3f1 e3d3fbff 00000000 00000010 00000001 00000000 00000001
Checking 'hlt' instruction... OK.
Brought up 1 CPUs
migration_cost=0
Grant table initialized
NET: Registered protocol family 16
Brought up 1 CPUs
xen_mem: Initialising balloon driver.
highmem bounce pool size: 64 pages
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
i8042.c: No controller found.
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Xen virtual console successfully installed as tty1
Event-channel device installed.
netfront: Initialising virtual ethernet driver.
mice: PS/2 mouse device common for all mice
md: md driver 0.90.3 MAX_MD_DEVS=256, MD_SB_DISKS=27
md: bitmap version 4.39
NET: Registered protocol family 2
Registering block device major 8
IP route cache hash table entries: 65536 (order: 6, 262144 bytes)
TCP established hash table entries: 262144 (order: 9, 2097152 bytes)
TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
TCP: Hash tables configured (established 262144 bind 65536)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 15
Using IPI No-Shortcut mode
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
kjournald starting.  Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 144k freed

  ***************************************************************
  ***************************************************************
  ** WARNING: Currently emulating unsupported memory accesses  **
  **          in /lib/tls glibc libraries. The emulation is    **
  **          slow. To ensure full performance you should      **
  **          install a 'xen-friendly' (nosegneg) version of   **
  **          the library, or disable tls support by executing **
  **          the following as root:                           **
  **          mv /lib/tls /lib/tls.disabled                    **
  ** Offending process: init (pid=1)                           **
  ***************************************************************
  ***************************************************************

Pausing... 1<3>BUG: soft lockup detected on CPU#0!

Pid: 1, comm:                 init
EIP: 0061:[<c0107ce6>] CPU: 0
EIP is at delay_tsc+0x16/0x20
 EFLAGS: 00000216    Not tainted  (2.6.16-xenU #1)
EAX: 0015462d EBX: 0024ba32 ECX: 22de0067 EDX: 001e673c
ESI: 00000001 EDI: c0110950 EBP: ed7c1f18 DS: 007b ES: 007b
CR0: 8005003b CR2: b7e970a0 CR3: 003a2000 CR4: 00000660
 [<c0105b83>] show_trace+0x13/0x20
 [<c01033cf>] show_regs+0x1bf/0x1f0
 [<c013ef58>] softlockup_tick+0x88/0xa0
 [<c0128025>] do_timer+0x215/0x440
 [<c010855c>] timer_interrupt+0x1bc/0x650
 [<c013f0af>] handle_IRQ_event+0x3f/0xd0
 [<c013f1ce>] __do_IRQ+0x8e/0xf0
 [<c0106e9d>] do_IRQ+0x1d/0x30
 [<c024ac31>] evtchn_do_upcall+0xa1/0xe0
 [<c01052dc>] hypervisor_callback+0x2c/0x34
 [<c0224b14>] __delay+0x14/0x20
 [<c0224b56>] __const_udelay+0x36/0x40
 [<c0110a7c>] do_fixup_4gb_segment+0x12c/0x150
 [<c01052ab>] error_code+0x2b/0x30
Continuing...

md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
dm_mod: no version for "struct_module" found: kernel tainted.
device-mapper: 4.5.0-ioctl (2005-10-04) initialised: dm-devel@redhat.com
EXT3 FS on sda1, internal journal
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sda2, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
[root@domu-12-31-33-00-01-7b ~]# cat /etc/redhat-release
Fedora Core release 4 (Stentz)
[root@domu-12-31-33-00-01-7b log]# cat /proc/meminfo
MemTotal:      1740944 kB
MemFree:       1663008 kB
Buffers:          3988 kB
Cached:          34364 kB
SwapCached:          0 kB
Active:          23144 kB
Inactive:        22412 kB
HighTotal:     1003528 kB
HighFree:       952904 kB
LowTotal:       737416 kB
LowFree:        710104 kB
SwapTotal:           0 kB
SwapFree:            0 kB
Dirty:               0 kB
Writeback:           0 kB
Mapped:          12492 kB
Slab:             6616 kB
CommitLimit:    870472 kB
Committed_AS:    17336 kB
PageTables:        500 kB
VmallocTotal:   118776 kB
VmallocUsed:       176 kB
VmallocChunk:   118536 kB
[root@domu-12-31-33-00-01-7b log]# cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 37
model name      : AMD Opteron(tm) Processor 250
stepping        : 1
cpu MHz         : 2405.448
cache size      : 1024 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm ts fid vid ttp
bogomips        : 4813.88
[root@domu-12-31-33-00-01-7b log]# traceroute ftp.iij.ad.jp
traceroute to ftp.iij.ad.jp (202.232.140.131), 30 hops max, 38 byte packets
 1  dom0-216-182-226-28 (216.182.226.28)  0.104 ms  0.055 ms  0.050 ms
 2  othr-216-182-226-3 (216.182.226.3)  0.331 ms  0.264 ms  0.224 ms
 3  othr-216-182-224-19 (216.182.224.19)  0.850 ms  0.745 ms  0.739 ms
 4  ge-4-22.car1.Washington1.Level3.net (4.79.228.45)  0.853 ms  2.108 ms  8.255 ms
 5  ae-23-52.car3.Washington1.Level3.net (4.68.121.48)  1.956 ms ae-13-51.car3.Washington1.Level3.net (4.68.121.16)  1.653 ms ae-23-52.car3.Washington1.Level3.net (4.68.121.48)  1.640 ms
 6  iiji-Level3-vlan.Washington1.Level3.net (209.0.227.102)  1.930 ms  2.024 ms  2.380 ms
 7  lax002bb00.IIJ.net (216.98.96.173)  73.808 ms  72.974 ms  72.968 ms
 8  tky008bb00.IIJ.Net (216.98.96.178)  187.419 ms  187.697 ms  187.178 ms
 9  tky008agr00.IIJ.Net (58.138.104.26)  187.985 ms  188.287 ms  187.900 ms
10  tky008gengw704.IIJ.Net (210.138.61.4)  190.400 ms  188.199 ms  188.080 ms
11  ftp1.iij.ad.jp (202.232.140.131)  187.764 ms  187.774 ms  188.602 ms
[root@domu-12-31-33-00-01-7b log]# traceroute d.hatena.ne.jp
traceroute: Warning: d.hatena.ne.jp has multiple addresses; using 221.186.146.29
traceroute to d.hatena.ne.jp (221.186.146.29), 30 hops max, 38 byte packets
 1  dom0-216-182-226-28 (216.182.226.28)  0.121 ms  0.056 ms  0.046 ms
 2  othr-216-182-226-3 (216.182.226.3)  0.262 ms  0.227 ms  0.223 ms
 3  othr-216-182-224-19 (216.182.224.19)  0.819 ms  0.742 ms  0.732 ms
 4  ge-4-22.car1.Washington1.Level3.net (4.79.228.45)  0.841 ms  0.827 ms  0.821 ms
 5  ae-1-55.bbr1.Washington1.Level3.net (4.68.121.129)  14.590 ms ae-1-53.bbr1.Washington1.Level3.net (4.68.121.65)  1.114 ms ae-1-55.bbr1.Washington1.Level3.net (4.68.121.129)  1.035 ms
 6  so-6-0-0.edge1.Washington1.Level3.net (209.244.11.10)  1.569 ms so-7-0-0.edge1.Washington1.Level3.net (209.244.11.14)  1.542 ms so-6-0-0.edge1.Washington1.Level3.net (209.244.11.10)  1.543 ms
 7  p16-1-0-3.r21.asbnva01.us.bb.gin.ntt.net (129.250.9.161)  1.579 ms  1.693 ms  1.552 ms
 8  ae-0.r20.asbnva01.us.bb.gin.ntt.net (129.250.2.16)  1.843 ms  1.819 ms  1.738 ms
     MPLS Label=235331 CoS=0 TTL=1 S=1
 9  p64-2-2-0.r20.mlpsca01.us.bb.gin.ntt.net (129.250.2.10)  71.902 ms  72.034 ms  71.882 ms
     MPLS Label=741971 CoS=0 TTL=1 S=1
10  p64-0-2-0.r21.osakjp01.jp.bb.gin.ntt.net (129.250.4.110)  196.863 ms  195.112 ms  195.061 ms
11  xe-1-1-0.a20.osakjp01.jp.ra.gin.ntt.net (61.200.80.174)  200.952 ms  184.748 ms  183.818 ms
12  61.200.82.146 (61.200.82.146)  184.988 ms  184.895 ms  200.958 ms
13  60.37.18.37 (60.37.18.37)  201.105 ms  201.101 ms  184.788 ms
14  61.207.14.185 (61.207.14.185)  200.950 ms  210.449 ms  184.905 ms
15  61.207.14.26 (61.207.14.26)  196.890 ms  196.895 ms  196.790 ms
16  210.254.188.202 (210.254.188.202)  196.969 ms  196.855 ms  196.958 ms
17  60.37.11.38 (60.37.11.38)  198.852 ms  198.880 ms  200.607 ms
18  221.184.12.230 (221.184.12.230)  196.977 ms  196.999 ms  197.011 ms
19  221.113.149.18 (221.113.149.18)  197.875 ms  197.843 ms  197.968 ms
20  221.186.146.30 (221.186.146.30)  201.940 ms  208.126 ms  200.864 ms
21  * * *

個人で使うにはちょっと高いが、仕事でこれ使ってデータセンターが不要になるなら、考える余地はありそう。

スパム対策のためのダミーです。もし見えても何も入力しないでください
ゲスト


画像認証