File: Zend_Service_Amazon_Ec2-Instance.xml

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (621 lines) | stat: -rw-r--r-- 26,450 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: 24249 -->
<!-- Reviewed: no -->
<sect1 id="zend.service.amazon.ec2.instance">
    <title>Zend_Service_Amazon_Ec2: Instanzen</title>

    <sect2 id="zend.service.amazon.ec2.instance.types">
        <title>Instanz Typen</title>

        <para>
            Amazon EC2 Instanzen werden in zwei Familien gruppiert: Standard und High-CPU. Standard
            Instanzen haben Speicher und <acronym>CPU</acronym> Ratio die für die meisten generell
            gedachten Anwendungen passen; High-CPU Instanzen haben proportional mehr
            <acronym>CPU</acronym> Ressourcen als Speicher (RAM) und sind gedacht für
            rechen-intensive Anwendungen. Wenn Instanz-Typen ausgewählt werden, kann es gewünscht
            sein wenig intensive Instanztypen für Web-Server Instanzen zu verwenden und intensivere
            Instanz-Typen für eigene Datenbank-Instanzen. Zusätzlich kann es gewünscht sein
            <acronym>CPU</acronym> Instanztypen für <acronym>CPU</acronym>-intensive
            Datenverarbeitungs Tasks zu verwenden.
        </para>

        <para>
            Eine der Vorteile von EC2 ist das man pro Stunde der Instanz zahlt, was es bequem und
            kostengünstig macht die Performance der eigenen Anwendung auf verschiedenen
            Instanzfamilien und Typen zu testen. Ein guter Weg um zu erkennen welches die
            passenste Instanzfamilie und der passenste Instanztyp ist, besteht darin Testinstanzen
            zu starten und die Anweundung zu benchmarken.
        </para>

        <note>
            <title>Instanz Typen</title>

            <para>
                Der Instanztyp ist als Konstante im Code definiert. Spalte acht in der Tabelle ist
                der definierte Name der Konstante
            </para>
        </note>

        <table id="zend.service.amazon.ec2.instance.types-table">
            <title>Vorhandene Instanztypen</title>

            <tgroup cols="8">
                <thead>
                    <row>
                        <entry>Typ</entry>
                        <entry><acronym>CPU</acronym></entry>
                        <entry>Hauptspeicher</entry>
                        <entry>Plattenspeicher</entry>
                        <entry>Plattform</entry>
                        <entry>I/O</entry>
                        <entry>Name</entry>
                        <entry>Name der Konstante</entry>
                    </row>
                </thead>
                <tbody>

                    <row>
                        <entry><code>Klein</code></entry>

                        <entry>
                            <para>
                                1 <constant>EC2</constant> Recheneinheit (1 virtueller Kern mit 1
                                <constant>EC2</constant> Recheneinheit)
                            </para>
                        </entry>

                        <entry><para>1.7 GB</para></entry>

                        <entry>
                            <para>
                                160 GB Speicher der Instanz (150 GB plus 10 GB Root Partition)
                            </para>
                        </entry>

                        <entry><para>32-bit</para></entry>
                        <entry><para>Moderat</para></entry>
                        <entry><para>m1.small</para></entry>
                        <entry><constant>Zend_Service_Amazon_Ec2_Instance::SMALL</constant></entry>
                    </row>

                    <row>
                        <entry><code>Groß</code></entry>

                        <entry>
                            <para>
                                4 <constant>EC2</constant> Recheneinheiten (2 virtuelle Kerne mit
                                jeweils 2 <constant>EC2</constant> Recheneinheiten)
                            </para>
                        </entry>

                        <entry><para>7.5 GB</para></entry>

                        <entry>
                            <para>
                                850 GB Speicher der Instanz (2 x 420 GB plus 10 GB Root Partition)
                            </para>
                        </entry>

                        <entry><para>64-bit</para></entry>
                        <entry><para>Hoch</para></entry>
                        <entry><para>m1.large</para></entry>
                        <entry><constant>Zend_Service_Amazon_Ec2_Instance::LARGE</constant></entry>
                    </row>

                    <row>
                        <entry><code>Extra Groß</code></entry>

                        <entry>
                            <para>
                                8 <constant>EC2</constant> Recheneinheiten (4 virtuelle Kerne mit
                                jeweils 2 <constant>EC2</constant> Recheneinheiten)
                            </para>
                        </entry>

                        <entry><para>15 GB</para></entry>

                        <entry>
                            <para>
                                1,690 GB Speicher der Instanz (4 x 420 GB plus 10 GB Root Partition)
                            </para>
                        </entry>

                        <entry><para>64-bit</para></entry>
                        <entry><para>Hoch</para></entry>
                        <entry><para>m1.xlarge</para></entry>
                        <entry><constant>Zend_Service_Amazon_Ec2_Instance::XLARGE</constant></entry>
                    </row>

                    <row>
                        <entry><code>High-CPU Medium</code></entry>

                        <entry>
                            <para>
                                5 <constant>EC2</constant> Recheneinheiten (2 virtuelle Kerne mit
                                jeweils 2.5 <constant>EC2</constant> Recheneinheiten)
                            </para>
                        </entry>

                        <entry><para>1.7 GB</para></entry>

                        <entry>
                            <para>
                                350 GB Speicher der Instanz (340 GB plus 10 GB Root Partition)
                            </para>
                        </entry>

                        <entry><para>32-bit</para></entry>
                        <entry><para>Durchschnittlich</para></entry>
                        <entry><para>c1.medium</para></entry>

                        <entry>
                            <constant>Zend_Service_Amazon_Ec2_Instance::HCPU_MEDIUM</constant>
                        </entry>
                    </row>

                    <row>
                        <entry><code>High-CPU Extra Groß</code></entry>

                        <entry>
                            <para>
                                20 <constant>EC2</constant> Recheneinheiten (8 virtuelle Kerne mit
                                jeweils 2.5 <constant>EC2</constant> Recheneinheiten)
                            </para>
                        </entry>

                        <entry><para>7 GB</para></entry>
                        <entry>
                            <para>
                                1,690 GB Speicher der Instanz (4 x 420 GB plus 10 GB Root Partition)
                            </para>
                        </entry>

                        <entry><para>64-bit</para></entry>
                        <entry><para>Hoch</para></entry>
                        <entry><para>c1.xlarge</para></entry>

                        <entry>
                            <constant>Zend_Service_Amazon_Ec2_Instance::HCPU_XLARGE</constant>
                        </entry>
                    </row>
                </tbody>
            </tgroup>
        </table>
    </sect2>

    <sect2 id="zend.service.amazon.ec2.instance.operations">
        <title>Ausführen von Amazon EC2 Instanzen</title>

        <para>
            Dieses Kapitel beschreibt die Methoden für die Behandlung von Amazon EC2 Instanzen.
        </para>

        <example id="zend.service.amazon.ec2.instance.operations.run">
            <title>Starten neuer EC2 Instanzen</title>

            <para>
                <code>run</code> startetn eine spezifische Anzahl von EC2 Instanzen.
                <code>run</code> nimmt für den Start ein Array von Parametern. Anbei ist eine
                Tabelle welche die gültigen Werte enthält.
            </para>

            <para>
                <table id="zend.service.amazon.ec2.instance.operations.run-table">
                    <title>Gültige Optionen für das Starten</title>

                    <tgroup cols="3">
                        <thead>
                            <row>
                                <entry>Name</entry>
                                <entry>Beschreibung</entry>
                                <entry>Benötigt</entry>
                            </row>
                        </thead>

                        <tbody>
                            <row>
                                <entry><code>imageId</code></entry>

                                <entry>
                                    <para>
                                        ID der <acronym>AMI</acronym> mit der Instanzen gestartet
                                        werden.
                                    </para>
                                </entry>

                                <entry><para>Ja</para></entry>
                            </row>

                            <row>
                                <entry><code>minCount</code></entry>

                                <entry>
                                    <para>
                                        Minimale Anzahl der zu startenden Instanzen. Standardwert: 1
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>maxCount</code></entry>

                                <entry>
                                    <para>
                                        Maximale Anzahl der zu startenden Instanzen. Standardwert: 1
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>keyName</code></entry>

                                <entry>
                                    <para>
                                        Name des Schlüsselpaares mit dem Instanzen gestartet werden.
                                        Wenn man keinen Schlüssel angibt, werden alle Instanzen
                                        unangreifbar.
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>securityGroup</code></entry>

                                <entry>
                                    <para>
                                        Name der Sicherheitsgruppe mit der Instanzen zu assoziieren
                                        sind.
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>userData</code></entry>

                                <entry>
                                    <para>
                                        Die Benutzerdaten welche bei den zu startenden Instanzen
                                        vorhanden sind. Diese sollten nicht Base64 verschlüsselt
                                        sein.
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>instanceType</code></entry>

                                <entry>
                                    <para>
                                        Spezifiziert den Instanztyp. Standardwert: m1.small
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>placement</code></entry>

                                <entry>
                                    <para>
                                        Spezifiziert die Availability Zone in der Instanz(en) zu
                                        starten sind. Standardmäßig wählt Amazon
                                        <constant>EC2</constant> eine Availability Zone aus.
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>kernelId</code></entry>

                                <entry>
                                    <para>
                                        Die ID des Kernels mit dem die Instanz gestartet werden
                                        soll.
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>ramdiskId</code></entry>

                                <entry>
                                    <para>
                                        Die ID der <acronym>RAM</acronym> Disk mit der die Instanz
                                        gestartet werden soll.
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>blockDeviceVirtualName</code></entry>

                                <entry>
                                    <para>
                                        Spezifiziert den virtuellen Name der zu dem
                                        korrespondierenden Devicenamen gemappt werden soll. Zum
                                        Beispiel: instancestore0
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>blockDeviceName</code></entry>

                                <entry>
                                    <para>
                                        Spezifiziert das Device zu dem der virtuelle Name gemappt
                                        werden soll. Zum Beispiel: sdb
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>

                            <row>
                                <entry><code>monitor</code></entry>

                                <entry>
                                    <para>
                                         Schaltet das Monitoring für die <acronym>AWS</acronym>
                                         CloudWatch Instanz ein
                                    </para>
                                </entry>

                                <entry><para>Nein</para></entry>
                            </row>
                        </tbody>
                    </tgroup>
                </table>
            </para>

            <para>
                <code>run</code> gibt Informationen über jede Instanz zurück die gestartet wird.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->run(array('imageId' => 'ami-509320',
                                   'keyName' => 'myKey',
                                   'securityGroup' => array('web',
                                                            'default')));
]]></programlisting>
        </example>

        <example id="zend.service.amazon.ec2.instance.operations.reboot">
            <title>Neu booten von EC2 Instanzen</title>

            <para>
                <code>reboot</code> bootet eine oder mehrere Instanzen.
            </para>

            <para>
                Diese Operation ist asynchron; die queuet nur die Anfrage eine spezifizierte
                Instanz(en) zu rebooten. Die Operation wird erfolgreich sein wenn die Instanzen
                gültig sind und dem Benutzer gehören. Anfragen um beendete Instanzen zu rebooten
                werden ignoriert.
            </para>

            <para>
                <code>reboot</code> gibt ein boolsches <constant>TRUE</constant> oder
                <constant>FALSE</constant> zurück
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->reboot('instanceId');
]]></programlisting>
        </example>

        <example id="zend.service.amazon.ec2.instance.operations.terminate">
            <title>Beenden von EC2 Instanzen</title>

            <para>
                <code>terminate</code> führt eine oder mehrere Instanzen herunter. Diese Operation
                ist idempotent; wenn eine Instanz mehr als einmal terminiert wird, wird jeder
                Aufruf erfolgreich sein.
            </para>

            <para>
                <code>terminate</code> gibt ein boolsches <constant>TRUE</constant> oder
                <constant>FALSE</constant> zurück
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->terminate('instanceId');
]]></programlisting>
        </example>

        <note>
            <title>Terminierte Instanzen</title>
            <para>Terminierte Instanzen bleiben nach der Terminierung sichtbar (voraussichtlich
            eine Stunde).</para>
        </note>
    </sect2>

    <sect2 id="zend.service.amazon.ec2.instance.utility">
        <title>Utilities für Amazon Instanzen</title>

        <para>
            In diesem Kapitel erfährt man wie man Informationen über die Ausgabe der Console
            erhält und sieht ob eine Instanz einen Produktcode enthält.
        </para>

        <example id="zend.service.amazon.ec2.instance.utility.describe">
            <title>Instanzen beschreiben</title>

            <para>
                <code>describe</code> gibt Information über die Instanzen zurück die einem
                gehören.
            </para>

            <para>
                Wenn man eine oder mehrere Instanz IDs spezifiziert, gibt Amazon EC2 Informationen
                über diese Instanzen zurück. Wenn man keine Instanz IDs spezifiziert, gibt Amazon
                EC2 Informationen über alle relevanten Instanzen zurück. Wenn eine ungültige
                Instanz ID spezifiziert wird, wird ein Fehler zurückgegeben. Wenn eine Instanz
                spezifiziert wird die man nicht besitzt, wird diese in den zurückgegebenen
                Ergebnissen nicht enthalten sein.
            </para>

            <para>
                <code>describe</code> gibt ein Array zurück das Informationen über die Instanz
                enthält.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->describe('instanceId');
]]></programlisting>
        </example>

        <note>
            <title>Beendete Instanzen</title>

            <para>
                Kürzlich beendete Instanzen können in den zurückgegebenen Ergebnissen
                vorkommen. Das Interval ist normalerweise weniger als eine Stunde. Wenn man
                nicht will das beendete Instanzen zurückgegeben werden, muß eine zweite
                Variable, ein boolsches <constant>TRUE</constant>, an <code>describe</code>
                übergeben werden, und die beendete Instanz wird ignoriert.
            </para>
        </note>

        <example id="zend.service.amazon.ec2.instance.utility.describebyimageid">
            <title>Instanzen anhand der Image Id beschreiben</title>

            <para>
                <code>describeByImageId</code> ist funktional identisch mit <code>describe</code>
                gibt aber nur die Instanz zurück, welche die angegebene imageId verwendet.
            </para>

            <para>
                <code>describeByImageId</code>  gibt ein Array zurück das Informationen über die
                Instanzen enthält, die von der übergebenen imageId gestartet wurden.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->describeByImageId('imageId');
]]></programlisting>
        </example>

        <note>
            <title>Beendete Instanzen</title>

            <para>
                Kürzlich beendete Instanzen können in den zurückgegebenen Ergebnissen
                vorkommen. Das Interval ist normalerweise weniger als eine Stunde. Wenn man
                nicht will das beendete Instanzen zurückgegeben werden, muß eine zweite
                Variable, ein boolsches <constant>TRUE</constant>, an <code>describe</code>
                übergeben werden, und die beendete Instanz wird ignoriert.
            </para>
        </note>

        <example id="zend.service.amazon.ec2.instance.utility.consoleOutput">
            <title>Empfangen von Konsolen-Ausgaben</title>

            <para>
                <code>consoleOutput</code> empfänge die Ausgabe der Konsole für eine spezifizierte
                Instanz.
            </para>

            <para>
                Die Ausgabe der Konsole einer Instanz wird gepuffert und kurz nach dem Booten, neu
                Booten, und Beenden der Instanz gesendet. Amazon EC2 sichert die letzten 64 KB
                Ausgabe, welche zumindest eine Stunde nach dem letzten Senden verfügbar sein ist.
            </para>

            <para>
                <code>consoleOutput</code> gibt ein Array zurück das
                <code>instanceId</code>, <code>timestamp</code> von der letzten Ausgabe enthält und
                <code>output</code> von der Konsole.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->consoleOutput('instanceId');
]]></programlisting>
        </example>

        <example id="zend.service.amazon.ec2.instance.utility.confirmproduct">
            <title>Produktcode an einer Instanz bestätigen</title>

            <para>
                <code>confirmProduct</code> gibt <constant>TRUE</constant> zurück wenn der
                spezifizierte Produktcode der spezifizierten Instanz angehängt ist. Die Operation
                gibt <constant>FALSE</constant> zurück wenn der Produktcode der Instanz nicht
                angehängt ist.
            </para>

            <para>
                Die <code>confirmProduct</code> Operation kann nur von dem Eigentümer der
                <acronym>AMI</acronym> ausgeführt werden. Dieses Feature ist nützlich wenn ein
                <acronym>AMI</acronym> Eigentümer Support anbietet und sicherstellen will ob die
                Instanz eines Benutzer korrekt ist.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->confirmProduct('productCode', 'instanceId');
]]></programlisting>
        </example>

        <example id="zend.service.amazon.ec2.instance.utility.monitor">
            <title>Einschalten des CloudWatch Monitorings für Instanzen</title>

            <para>
                <code>monitor</code> gibt die Liste von Instanzn und deren aktuellen Status vom
                CloudWatch Monitorings zurück. Wenn die Instant das Monitoring aktuell nicht
                aktiviert hat, dann wird es eingeschaltet.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->monitor('instanceId');
]]></programlisting>
        </example>

        <example id="zend.service.amazon.ec2.instance.utility.unmonitor">
            <title>Ausschalten des CloudWatch Monitorings für Instanzen</title>

            <para>
                <code>monitor</code> gibt die Liste von Instanzn und deren aktuellen Status vom
                CloudWatch Monitorings zurück. Wenn die Instant das Monitoring aktuell aktiviert
                hat, dann wird es ausgeschaltet.
            </para>
            <programlisting language="php"><![CDATA[
$ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
                                                     'aws_secret_key');
$return = $ec2_instance->unmonitor('instanceId');
]]></programlisting>
        </example>
    </sect2>
</sect1>