Subject: | Issues with print $inst->instance_id |
I'm trying out Net::Amazon::EC2 0.05, and having some issues with the
example provided in the documentation:
Show quoted text
--- code snippet ---
use Net::Amazon::EC2;
my $ec2 = Net::Amazon::EC2->new(
AWSAccessKeyId => '<id>',
SecretAccessKey => '<key>',
debug => '1',
);
my $running_instances = $ec2->describe_instances;
foreach my $inst (@{$running_instances}) {
print $inst->instance_id . "\n";
}
--- end of code ---
--- output ---
QUERY TO SIGN:
ActionDescribeInstancesAWSAccessKeyId<>SignatureVersion1Timestamp2008-01-22T17:45:47.000ZVersion2007-08-29
GENERATED QUERY URL:
http://ec2.amazonaws.com?AWSAccessKeyId=<>&Signature=<>&Version=2007-08-29&Timestamp=2008-01-22T17%3A45%3A47.000Z&Action=DescribeInstances&SignatureVersion=1
Can't locate object method "instance_id" via package
"Net::Amazon::EC2::ReservationInfo" at ./start-hadoop-node.pl line 24.
--- end of output ---
Also, the documented sample should probably trap errors when creating an
instance - ie, if the instance type of the ami is m1.large, and you run:
my $instance = $ec2->run_instances(ImageId => 'ami-XXXXXXXX',
MinCount => 1, MaxCount => 1);
the error is not trapped.