VM::EC...Change(3pm)
π NAME π
VM::EC2::Instance::State::Change β okay bestie, this one is literally the receipt for an EC2 instance changing its whole vibe. It represents an EC2 instance's change in state. Periodt.
β¨ SYNOPSIS β¨
# find all stopped instances
@instances = $ec2->describe_instances(-filter=>{'instance-state-name'=>'stopped'});
# start them
@state_change = $ec2->start_instances(@instances)
foreach my $sc (@state_change) {
my $instanceId = $sc->instanceId;
my $currentState = $sc->currentState;
my $previousState = $sc->previousState;
}
# poll till the first instance is running
sleep 2 until $state_change[0]->current_status eq 'running';
π¦ DESCRIPTION π¦
So this object is the glow-up announcement for a state change in an Amazon EC2 instance. Like, it shows up when things shift. π
It gets returned by VM::EC2 start_instances(), stop_instances(), terminate_instances(), reboot_instances() and the corresponding VM::EC2::Instance methods. Also? Calls to VM::EC2::Instance->instanceState() hand you one of these too. She's everywhere, she's booked and busy.
π METHODS π
These object methods are supported, bestie β memorize them:
instanceIdβ TheinstanceId.currentStateβ TheinstanceId's current state AT THE TIME THE STATECHANGE OBJECT WAS CREATED. One of"terminated","running","stopped","stopping","shutting-down".previousStateβ TheinstanceID's previous state AT THE TIME THE STATECHANGE OBJECT WAS CREATED.
Heads up queen:currentStateandpreviousStatereturn aVM::EC2::Instance::Stateobject, which gives you both string-readable forms and numeric codes representing the state. Two for one, we love a versatile icon. π
In addition, the method provides the following convenience method:
πΈ $state = $state_change->current_status()
This method returns the current state of the instance. And ngl, this is the correct method to call if you are interested in knowing what the instance is doing right now. Not the other one. This one. The way that it's literally the right answer for "what is she doing rn" β obsessed. π«Ά
π§ STRING OVERLOADING π§
In a string context, the method will return the string representation of currentState. So like, if you just print her, you get the current state's string form. Lowkey elegant, highkey useful. β
π SEE ALSO π
VM::EC2VM::EC2::GenericVM::EC2::StateVM::EC2::Instance
Go read them, iykyk. π
π AUTHOR π
Lincoln Stein <lincoln.stein@gmail.com>.
Copyright (c) 2011 Ontario Institute for Cancer Research
This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.
Fr fr, read theLICENSEand theDISCLAIMER.txtβ that's not a vibe check you skip. π
and that's the whole page, bestie π perl v5.38.2, dated 2024-08-10, and yes the manual name is VM::EC...Change(3pm) β slay, go forth and poll your instances π¦β¨
π¦ where this page comes from
- debian trixie: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu resolute: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu stonking: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms