Subject: | new EC2 instance appears in wrong availability zone |
Thanks for releasing VM::EC2. I'm using it for a simple project, and running into a problem
where new EC2 instances appear in the wrong availability zone. Possibly I'm using the API
incorrectly, in which case I hope to help you improve the documentation.
Here are some details about my environment, and a test case. I'm using environment
variables to provide my EC2 credentials, and I am operating in the us-east-1 region.
$ perl -v
This is perl, v5.10.0 built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
$ perl -w -Mstrict -MVM::EC2 -MData::Dumper -e 'print "VM::EC2::VERSION
$VM::EC2::VERSION\n"; my $zone = "us-east-1c"; print "starting new instance in $zone\n";
my $ec2 = VM::EC2->new(); my $new = $ec2->run_instances(-image_id => "ami-
4a24d623", -placement_zone => $zone, -instance_type => "t1.micro") or die $!; printf "new
instance %s in zone %s, state %s\n", $new, $new->placement->availabilityZone, $new-
Show quoted text
>current_status; $ec2->wait_for_instances($new); printf "new instance %s in zone %s, state
%s\n", $new, $new->placement->availabilityZone, $new->current_status; $new->terminate
or die $!;'
VM::EC2::VERSION 1.03
starting new instance in us-east-1c
Use of uninitialized value in join or string at /Library/Perl/5.10.0/VM/EC2.pm line 2852.
new instance i-13385672 in zone us-east-1b, state pending
new instance i-13385672 in zone us-east-1b, state running
As you can see, the instance is requested in us-east-1c but shows up in us-east-1b instead.
I've verified that Amazon's own EC2 console and ec2-describe-instances tool also show us-
east-1b. Naturally I'm concerned about the "uninitialized value" warning: that seems to be
coming from code that generates the query string. But perhaps you'll spot a typo in my test
case, or some misuse of the API. If so, thanks in advance for the clue.