Zend_Service_Amazon_Ec2-Instance.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- EN-Revision: 24249 -->
  3. <!-- Reviewed: no -->
  4. <sect1 id="zend.service.amazon.ec2.instance">
  5. <title>Zend_Service_Amazon_Ec2: Instanzen</title>
  6. <sect2 id="zend.service.amazon.ec2.instance.types">
  7. <title>Instanz Typen</title>
  8. <para>
  9. Amazon EC2 Instanzen werden in zwei Familien gruppiert: Standard und High-CPU. Standard
  10. Instanzen haben Speicher und <acronym>CPU</acronym> Ratio die für die meisten generell
  11. gedachten Anwendungen passen; High-CPU Instanzen haben proportional mehr
  12. <acronym>CPU</acronym> Ressourcen als Speicher (RAM) und sind gedacht für
  13. rechen-intensive Anwendungen. Wenn Instanz-Typen ausgewählt werden, kann es gewünscht
  14. sein wenig intensive Instanztypen für Web-Server Instanzen zu verwenden und intensivere
  15. Instanz-Typen für eigene Datenbank-Instanzen. Zusätzlich kann es gewünscht sein
  16. <acronym>CPU</acronym> Instanztypen für <acronym>CPU</acronym>-intensive
  17. Datenverarbeitungs Tasks zu verwenden.
  18. </para>
  19. <para>
  20. Eine der Vorteile von EC2 ist das man pro Stunde der Instanz zahlt, was es bequem und
  21. kostengünstig macht die Performance der eigenen Anwendung auf verschiedenen
  22. Instanzfamilien und Typen zu testen. Ein guter Weg um zu erkennen welches die
  23. passenste Instanzfamilie und der passenste Instanztyp ist, besteht darin Testinstanzen
  24. zu starten und die Anweundung zu benchmarken.
  25. </para>
  26. <note>
  27. <title>Instanz Typen</title>
  28. <para>
  29. Der Instanztyp ist als Konstante im Code definiert. Spalte acht in der Tabelle ist
  30. der definierte Name der Konstante
  31. </para>
  32. </note>
  33. <table id="zend.service.amazon.ec2.instance.types-table">
  34. <title>Vorhandene Instanztypen</title>
  35. <tgroup cols="8">
  36. <thead>
  37. <row>
  38. <entry>Typ</entry>
  39. <entry><acronym>CPU</acronym></entry>
  40. <entry>Hauptspeicher</entry>
  41. <entry>Plattenspeicher</entry>
  42. <entry>Plattform</entry>
  43. <entry>I/O</entry>
  44. <entry>Name</entry>
  45. <entry>Name der Konstante</entry>
  46. </row>
  47. </thead>
  48. <tbody>
  49. <row>
  50. <entry><code>Klein</code></entry>
  51. <entry>
  52. <para>
  53. 1 <constant>EC2</constant> Recheneinheit (1 virtueller Kern mit 1
  54. <constant>EC2</constant> Recheneinheit)
  55. </para>
  56. </entry>
  57. <entry><para>1.7 GB</para></entry>
  58. <entry>
  59. <para>
  60. 160 GB Speicher der Instanz (150 GB plus 10 GB Root Partition)
  61. </para>
  62. </entry>
  63. <entry><para>32-bit</para></entry>
  64. <entry><para>Moderat</para></entry>
  65. <entry><para>m1.small</para></entry>
  66. <entry><constant>Zend_Service_Amazon_Ec2_Instance::SMALL</constant></entry>
  67. </row>
  68. <row>
  69. <entry><code>Groß</code></entry>
  70. <entry>
  71. <para>
  72. 4 <constant>EC2</constant> Recheneinheiten (2 virtuelle Kerne mit
  73. jeweils 2 <constant>EC2</constant> Recheneinheiten)
  74. </para>
  75. </entry>
  76. <entry><para>7.5 GB</para></entry>
  77. <entry>
  78. <para>
  79. 850 GB Speicher der Instanz (2 x 420 GB plus 10 GB Root Partition)
  80. </para>
  81. </entry>
  82. <entry><para>64-bit</para></entry>
  83. <entry><para>Hoch</para></entry>
  84. <entry><para>m1.large</para></entry>
  85. <entry><constant>Zend_Service_Amazon_Ec2_Instance::LARGE</constant></entry>
  86. </row>
  87. <row>
  88. <entry><code>Extra Groß</code></entry>
  89. <entry>
  90. <para>
  91. 8 <constant>EC2</constant> Recheneinheiten (4 virtuelle Kerne mit
  92. jeweils 2 <constant>EC2</constant> Recheneinheiten)
  93. </para>
  94. </entry>
  95. <entry><para>15 GB</para></entry>
  96. <entry>
  97. <para>
  98. 1,690 GB Speicher der Instanz (4 x 420 GB plus 10 GB Root Partition)
  99. </para>
  100. </entry>
  101. <entry><para>64-bit</para></entry>
  102. <entry><para>Hoch</para></entry>
  103. <entry><para>m1.xlarge</para></entry>
  104. <entry><constant>Zend_Service_Amazon_Ec2_Instance::XLARGE</constant></entry>
  105. </row>
  106. <row>
  107. <entry><code>High-CPU Medium</code></entry>
  108. <entry>
  109. <para>
  110. 5 <constant>EC2</constant> Recheneinheiten (2 virtuelle Kerne mit
  111. jeweils 2.5 <constant>EC2</constant> Recheneinheiten)
  112. </para>
  113. </entry>
  114. <entry><para>1.7 GB</para></entry>
  115. <entry>
  116. <para>
  117. 350 GB Speicher der Instanz (340 GB plus 10 GB Root Partition)
  118. </para>
  119. </entry>
  120. <entry><para>32-bit</para></entry>
  121. <entry><para>Durchschnittlich</para></entry>
  122. <entry><para>c1.medium</para></entry>
  123. <entry>
  124. <constant>Zend_Service_Amazon_Ec2_Instance::HCPU_MEDIUM</constant>
  125. </entry>
  126. </row>
  127. <row>
  128. <entry><code>High-CPU Extra Groß</code></entry>
  129. <entry>
  130. <para>
  131. 20 <constant>EC2</constant> Recheneinheiten (8 virtuelle Kerne mit
  132. jeweils 2.5 <constant>EC2</constant> Recheneinheiten)
  133. </para>
  134. </entry>
  135. <entry><para>7 GB</para></entry>
  136. <entry>
  137. <para>
  138. 1,690 GB Speicher der Instanz (4 x 420 GB plus 10 GB Root Partition)
  139. </para>
  140. </entry>
  141. <entry><para>64-bit</para></entry>
  142. <entry><para>Hoch</para></entry>
  143. <entry><para>c1.xlarge</para></entry>
  144. <entry>
  145. <constant>Zend_Service_Amazon_Ec2_Instance::HCPU_XLARGE</constant>
  146. </entry>
  147. </row>
  148. </tbody>
  149. </tgroup>
  150. </table>
  151. </sect2>
  152. <sect2 id="zend.service.amazon.ec2.instance.operations">
  153. <title>Ausführen von Amazon EC2 Instanzen</title>
  154. <para>
  155. Dieses Kapitel beschreibt die Methoden für die Behandlung von Amazon EC2 Instanzen.
  156. </para>
  157. <example id="zend.service.amazon.ec2.instance.operations.run">
  158. <title>Starten neuer EC2 Instanzen</title>
  159. <para>
  160. <code>run</code> startetn eine spezifische Anzahl von EC2 Instanzen.
  161. <code>run</code> nimmt für den Start ein Array von Parametern. Anbei ist eine
  162. Tabelle welche die gültigen Werte enthält.
  163. </para>
  164. <para>
  165. <table id="zend.service.amazon.ec2.instance.operations.run-table">
  166. <title>Gültige Optionen für das Starten</title>
  167. <tgroup cols="3">
  168. <thead>
  169. <row>
  170. <entry>Name</entry>
  171. <entry>Beschreibung</entry>
  172. <entry>Benötigt</entry>
  173. </row>
  174. </thead>
  175. <tbody>
  176. <row>
  177. <entry><code>imageId</code></entry>
  178. <entry>
  179. <para>
  180. ID der <acronym>AMI</acronym> mit der Instanzen gestartet
  181. werden.
  182. </para>
  183. </entry>
  184. <entry><para>Ja</para></entry>
  185. </row>
  186. <row>
  187. <entry><code>minCount</code></entry>
  188. <entry>
  189. <para>
  190. Minimale Anzahl der zu startenden Instanzen. Standardwert: 1
  191. </para>
  192. </entry>
  193. <entry><para>Nein</para></entry>
  194. </row>
  195. <row>
  196. <entry><code>maxCount</code></entry>
  197. <entry>
  198. <para>
  199. Maximale Anzahl der zu startenden Instanzen. Standardwert: 1
  200. </para>
  201. </entry>
  202. <entry><para>Nein</para></entry>
  203. </row>
  204. <row>
  205. <entry><code>keyName</code></entry>
  206. <entry>
  207. <para>
  208. Name des Schlüsselpaares mit dem Instanzen gestartet werden.
  209. Wenn man keinen Schlüssel angibt, werden alle Instanzen
  210. unangreifbar.
  211. </para>
  212. </entry>
  213. <entry><para>Nein</para></entry>
  214. </row>
  215. <row>
  216. <entry><code>securityGroup</code></entry>
  217. <entry>
  218. <para>
  219. Name der Sicherheitsgruppe mit der Instanzen zu assoziieren
  220. sind.
  221. </para>
  222. </entry>
  223. <entry><para>Nein</para></entry>
  224. </row>
  225. <row>
  226. <entry><code>userData</code></entry>
  227. <entry>
  228. <para>
  229. Die Benutzerdaten welche bei den zu startenden Instanzen
  230. vorhanden sind. Diese sollten nicht Base64 verschlüsselt
  231. sein.
  232. </para>
  233. </entry>
  234. <entry><para>Nein</para></entry>
  235. </row>
  236. <row>
  237. <entry><code>instanceType</code></entry>
  238. <entry>
  239. <para>
  240. Spezifiziert den Instanztyp. Standardwert: m1.small
  241. </para>
  242. </entry>
  243. <entry><para>Nein</para></entry>
  244. </row>
  245. <row>
  246. <entry><code>placement</code></entry>
  247. <entry>
  248. <para>
  249. Spezifiziert die Availability Zone in der Instanz(en) zu
  250. starten sind. Standardmäßig wählt Amazon
  251. <constant>EC2</constant> eine Availability Zone aus.
  252. </para>
  253. </entry>
  254. <entry><para>Nein</para></entry>
  255. </row>
  256. <row>
  257. <entry><code>kernelId</code></entry>
  258. <entry>
  259. <para>
  260. Die ID des Kernels mit dem die Instanz gestartet werden
  261. soll.
  262. </para>
  263. </entry>
  264. <entry><para>Nein</para></entry>
  265. </row>
  266. <row>
  267. <entry><code>ramdiskId</code></entry>
  268. <entry>
  269. <para>
  270. Die ID der <acronym>RAM</acronym> Disk mit der die Instanz
  271. gestartet werden soll.
  272. </para>
  273. </entry>
  274. <entry><para>Nein</para></entry>
  275. </row>
  276. <row>
  277. <entry><code>blockDeviceVirtualName</code></entry>
  278. <entry>
  279. <para>
  280. Spezifiziert den virtuellen Name der zu dem
  281. korrespondierenden Devicenamen gemappt werden soll. Zum
  282. Beispiel: instancestore0
  283. </para>
  284. </entry>
  285. <entry><para>Nein</para></entry>
  286. </row>
  287. <row>
  288. <entry><code>blockDeviceName</code></entry>
  289. <entry>
  290. <para>
  291. Spezifiziert das Device zu dem der virtuelle Name gemappt
  292. werden soll. Zum Beispiel: sdb
  293. </para>
  294. </entry>
  295. <entry><para>Nein</para></entry>
  296. </row>
  297. <row>
  298. <entry><code>monitor</code></entry>
  299. <entry>
  300. <para>
  301. Schaltet das Monitoring für die <acronym>AWS</acronym>
  302. CloudWatch Instanz ein
  303. </para>
  304. </entry>
  305. <entry><para>Nein</para></entry>
  306. </row>
  307. </tbody>
  308. </tgroup>
  309. </table>
  310. </para>
  311. <para>
  312. <code>run</code> gibt Informationen über jede Instanz zurück die gestartet wird.
  313. </para>
  314. <programlisting language="php"><![CDATA[
  315. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  316. 'aws_secret_key');
  317. $return = $ec2_instance->run(array('imageId' => 'ami-509320',
  318. 'keyName' => 'myKey',
  319. 'securityGroup' => array('web',
  320. 'default')));
  321. ]]></programlisting>
  322. </example>
  323. <example id="zend.service.amazon.ec2.instance.operations.reboot">
  324. <title>Neu booten von EC2 Instanzen</title>
  325. <para>
  326. <code>reboot</code> bootet eine oder mehrere Instanzen.
  327. </para>
  328. <para>
  329. Diese Operation ist asynchron; die queuet nur die Anfrage eine spezifizierte
  330. Instanz(en) zu rebooten. Die Operation wird erfolgreich sein wenn die Instanzen
  331. gültig sind und dem Benutzer gehören. Anfragen um beendete Instanzen zu rebooten
  332. werden ignoriert.
  333. </para>
  334. <para>
  335. <code>reboot</code> gibt ein boolsches <constant>TRUE</constant> oder
  336. <constant>FALSE</constant> zurück
  337. </para>
  338. <programlisting language="php"><![CDATA[
  339. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  340. 'aws_secret_key');
  341. $return = $ec2_instance->reboot('instanceId');
  342. ]]></programlisting>
  343. </example>
  344. <example id="zend.service.amazon.ec2.instance.operations.terminate">
  345. <title>Beenden von EC2 Instanzen</title>
  346. <para>
  347. <code>terminate</code> führt eine oder mehrere Instanzen herunter. Diese Operation
  348. ist idempotent; wenn eine Instanz mehr als einmal terminiert wird, wird jeder
  349. Aufruf erfolgreich sein.
  350. </para>
  351. <para>
  352. <code>terminate</code> gibt ein boolsches <constant>TRUE</constant> oder
  353. <constant>FALSE</constant> zurück
  354. </para>
  355. <programlisting language="php"><![CDATA[
  356. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  357. 'aws_secret_key');
  358. $return = $ec2_instance->terminate('instanceId');
  359. ]]></programlisting>
  360. </example>
  361. <note>
  362. <title>Terminierte Instanzen</title>
  363. <para>Terminierte Instanzen bleiben nach der Terminierung sichtbar (voraussichtlich
  364. eine Stunde).</para>
  365. </note>
  366. </sect2>
  367. <sect2 id="zend.service.amazon.ec2.instance.utility">
  368. <title>Utilities für Amazon Instanzen</title>
  369. <para>
  370. In diesem Kapitel erfährt man wie man Informationen über die Ausgabe der Console
  371. erhält und sieht ob eine Instanz einen Produktcode enthält.
  372. </para>
  373. <example id="zend.service.amazon.ec2.instance.utility.describe">
  374. <title>Instanzen beschreiben</title>
  375. <para>
  376. <code>describe</code> gibt Information über die Instanzen zurück die einem
  377. gehören.
  378. </para>
  379. <para>
  380. Wenn man eine oder mehrere Instanz IDs spezifiziert, gibt Amazon EC2 Informationen
  381. über diese Instanzen zurück. Wenn man keine Instanz IDs spezifiziert, gibt Amazon
  382. EC2 Informationen über alle relevanten Instanzen zurück. Wenn eine ungültige
  383. Instanz ID spezifiziert wird, wird ein Fehler zurückgegeben. Wenn eine Instanz
  384. spezifiziert wird die man nicht besitzt, wird diese in den zurückgegebenen
  385. Ergebnissen nicht enthalten sein.
  386. </para>
  387. <para>
  388. <code>describe</code> gibt ein Array zurück das Informationen über die Instanz
  389. enthält.
  390. </para>
  391. <programlisting language="php"><![CDATA[
  392. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  393. 'aws_secret_key');
  394. $return = $ec2_instance->describe('instanceId');
  395. ]]></programlisting>
  396. </example>
  397. <note>
  398. <title>Beendete Instanzen</title>
  399. <para>
  400. Kürzlich beendete Instanzen können in den zurückgegebenen Ergebnissen
  401. vorkommen. Das Interval ist normalerweise weniger als eine Stunde. Wenn man
  402. nicht will das beendete Instanzen zurückgegeben werden, muß eine zweite
  403. Variable, ein boolsches <constant>TRUE</constant>, an <code>describe</code>
  404. übergeben werden, und die beendete Instanz wird ignoriert.
  405. </para>
  406. </note>
  407. <example id="zend.service.amazon.ec2.instance.utility.describebyimageid">
  408. <title>Instanzen anhand der Image Id beschreiben</title>
  409. <para>
  410. <code>describeByImageId</code> ist funktional identisch mit <code>describe</code>
  411. gibt aber nur die Instanz zurück, welche die angegebene imageId verwendet.
  412. </para>
  413. <para>
  414. <code>describeByImageId</code> gibt ein Array zurück das Informationen über die
  415. Instanzen enthält, die von der übergebenen imageId gestartet wurden.
  416. </para>
  417. <programlisting language="php"><![CDATA[
  418. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  419. 'aws_secret_key');
  420. $return = $ec2_instance->describeByImageId('imageId');
  421. ]]></programlisting>
  422. </example>
  423. <note>
  424. <title>Beendete Instanzen</title>
  425. <para>
  426. Kürzlich beendete Instanzen können in den zurückgegebenen Ergebnissen
  427. vorkommen. Das Interval ist normalerweise weniger als eine Stunde. Wenn man
  428. nicht will das beendete Instanzen zurückgegeben werden, muß eine zweite
  429. Variable, ein boolsches <constant>TRUE</constant>, an <code>describe</code>
  430. übergeben werden, und die beendete Instanz wird ignoriert.
  431. </para>
  432. </note>
  433. <example id="zend.service.amazon.ec2.instance.utility.consoleOutput">
  434. <title>Empfangen von Konsolen-Ausgaben</title>
  435. <para>
  436. <code>consoleOutput</code> empfänge die Ausgabe der Konsole für eine spezifizierte
  437. Instanz.
  438. </para>
  439. <para>
  440. Die Ausgabe der Konsole einer Instanz wird gepuffert und kurz nach dem Booten, neu
  441. Booten, und Beenden der Instanz gesendet. Amazon EC2 sichert die letzten 64 KB
  442. Ausgabe, welche zumindest eine Stunde nach dem letzten Senden verfügbar sein ist.
  443. </para>
  444. <para>
  445. <code>consoleOutput</code> gibt ein Array zurück das
  446. <code>instanceId</code>, <code>timestamp</code> von der letzten Ausgabe enthält und
  447. <code>output</code> von der Konsole.
  448. </para>
  449. <programlisting language="php"><![CDATA[
  450. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  451. 'aws_secret_key');
  452. $return = $ec2_instance->consoleOutput('instanceId');
  453. ]]></programlisting>
  454. </example>
  455. <example id="zend.service.amazon.ec2.instance.utility.confirmproduct">
  456. <title>Produktcode an einer Instanz bestätigen</title>
  457. <para>
  458. <code>confirmProduct</code> gibt <constant>TRUE</constant> zurück wenn der
  459. spezifizierte Produktcode der spezifizierten Instanz angehängt ist. Die Operation
  460. gibt <constant>FALSE</constant> zurück wenn der Produktcode der Instanz nicht
  461. angehängt ist.
  462. </para>
  463. <para>
  464. Die <code>confirmProduct</code> Operation kann nur von dem Eigentümer der
  465. <acronym>AMI</acronym> ausgeführt werden. Dieses Feature ist nützlich wenn ein
  466. <acronym>AMI</acronym> Eigentümer Support anbietet und sicherstellen will ob die
  467. Instanz eines Benutzer korrekt ist.
  468. </para>
  469. <programlisting language="php"><![CDATA[
  470. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  471. 'aws_secret_key');
  472. $return = $ec2_instance->confirmProduct('productCode', 'instanceId');
  473. ]]></programlisting>
  474. </example>
  475. <example id="zend.service.amazon.ec2.instance.utility.monitor">
  476. <title>Einschalten des CloudWatch Monitorings für Instanzen</title>
  477. <para>
  478. <code>monitor</code> gibt die Liste von Instanzn und deren aktuellen Status vom
  479. CloudWatch Monitorings zurück. Wenn die Instant das Monitoring aktuell nicht
  480. aktiviert hat, dann wird es eingeschaltet.
  481. </para>
  482. <programlisting language="php"><![CDATA[
  483. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  484. 'aws_secret_key');
  485. $return = $ec2_instance->monitor('instanceId');
  486. ]]></programlisting>
  487. </example>
  488. <example id="zend.service.amazon.ec2.instance.utility.unmonitor">
  489. <title>Ausschalten des CloudWatch Monitorings für Instanzen</title>
  490. <para>
  491. <code>monitor</code> gibt die Liste von Instanzn und deren aktuellen Status vom
  492. CloudWatch Monitorings zurück. Wenn die Instant das Monitoring aktuell aktiviert
  493. hat, dann wird es ausgeschaltet.
  494. </para>
  495. <programlisting language="php"><![CDATA[
  496. $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
  497. 'aws_secret_key');
  498. $return = $ec2_instance->unmonitor('instanceId');
  499. ]]></programlisting>
  500. </example>
  501. </sect2>
  502. </sect1>