Skip Menu |
 

This queue is for tickets about the VM-EC2 CPAN distribution.

Report information
The Basics
Id: 70119
Status: resolved
Priority: 0/
Queue: VM-EC2

People
Owner: Nobody in particular
Requestors: mike+cpan [...] blakeley.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.03
Fixed in: (no value)



Subject: new EC2 instance appears in wrong availability zone
Download (untitled) / with headers
text/plain 2.2k
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.
The problem may be at EC2.pm:823 push @p,('Placement.AvailabilityZone'=>$args{-availability_zone}) if $args{- placement_zone}; If I have it right, this tests existence of placement_zone but gets the value of availability_zone. Workaround: set both parameters to the desired value. $ 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", -availability_zone => $zone, -placement_zone => $zone, -instance_type => "t1.micro") or die $!; printf STDERR "new instance %s in zone %s, state %s\n", $new, $new- Show quoted text
>placement->availabilityZone, $new->current_status; $ec2->wait_for_instances($new);
printf STDERR "new instance %s in zone %s, state %s\n", $new, $new->placement- Show quoted text
>availabilityZone, $new->current_status; $new->terminate or die $!;'
VM::EC2::VERSION 1.03 starting new instance in us-east-1c new instance i-8f8ae4ee in zone us-east-1c, state pending new instance i-8f8ae4ee in zone us-east-1c, state running
Download (untitled) / with headers
text/plain 247b
Thanks for reporting this bug. In fact it was a documentation bug: the correct argument is -availability_zone. I have fixed the documentation in version 1.04 and now accept both -placement_zone and -availability_aone as synonyms for each other.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.