1VM::EC2::Instance::StatUes:e:rChCaonngter(i3b)uted PerlVDMo:c:uEmCe2n:t:aItnisotnance::State::Change(3)
2
3
4

NAME

6       VM::EC2::Instance::State::Change - Represent an EC2 instance's change
7       in state.
8

SYNOPSIS

10            # find all stopped instances
11           @instances = $ec2->describe_instances(-filter=>{'instance-state-name'=>'stopped'});
12
13           # start them
14           @state_change = $ec2->start_instances(@instances)
15
16           foreach my $sc (@state_change) {
17               my $instanceId    = $sc->instanceId;
18               my $currentState  = $sc->currentState;
19               my $previousState = $sc->previousState;
20           }
21
22           # poll till the first instance is running
23           sleep 2 until $state_change[0]->current_status eq 'running';
24

DESCRIPTION

26       This object represents a state change in an Amazon EC2 instance.  It is
27       returned by VM::EC2 start_instances(), stop_instances(),
28       terminate_instances(), reboot_instances() and the corresponding
29       VM::EC2::Instance methods. In addition, this object is returned by
30       calls to VM::EC2::Instance->instanceState().
31

METHODS

33       These object methods are supported:
34
35        instanceId      -- The instanceId.
36        currentState    -- The instanceId's current state AT THE TIME
37                            THE STATECHANGE OBJECT WAS CREATED. One of
38                            "terminated", "running", "stopped", "stopping",
39                            "shutting-down".
40        previousState   -- The instanceID's previous state AT THE TIME
41                            THE STATECHANGE OBJECT WAS CREATED.
42
43       Note that currentState and previousState return a
44       VM::EC2::Instance::State object, which provides both string-readable
45       forms and numeric codes representing the state.
46
47       In addition, the method provides the following convenience method:
48
49   $state = $state_change->current_status()
50       This method returns the current state of the instance. This is the
51       correct method to call if you are interested in knowing what the
52       instance is doing right now.
53
54   STRING OVERLOADING
55       In a string context, the method will return the string representation
56       of currentState.
57

SEE ALSO

59       VM::EC2 VM::EC2::Generic VM::EC2::State VM::EC2::Instance
60

AUTHOR

62       Lincoln Stein <lincoln.stein@gmail.com>.
63
64       Copyright (c) 2011 Ontario Institute for Cancer Research
65
66       This package and its accompanying libraries is free software; you can
67       redistribute it and/or modify it under the terms of the GPL (either
68       version 1, or at your option, any later version) or the Artistic
69       License 2.0.  Refer to LICENSE for the full license text. In addition,
70       please see DISCLAIMER.txt for disclaimers of warranty.
71
72
73
74perl v5.34.0                      2022-01-21VM::EC2::Instance::State::Change(3)
Impressum