Net::Amazon::EC2 is a Perl interface to the Amazon Elastic Compute Cloud (EC2) environment.
SYNOPSIS
use Net::Amazon::EC2;
my $ec2 = Net::Amazon::EC2->new(
AWSAccessKeyId => 'PUBLIC_KEY_HERE',
SecretAccessKey => 'SECRET_KEY_HERE'
);
# Start 1 new instance from AMI: ami-XXXXXXXX
my $instance = $ec2->run_instances(ImageId => 'ami-XXXXXXXX', MinCount => 1, MaxCount => 1);
my $running_instances = $ec2->describe_instances();
foreach my $inst (@{$running_instances}) {
print "$inst->{instance}[0]{instanceId}n";
}
# Terminate instance
my $result = $ec2->terminate_instances(InstanceId => $instance->{instance}[0]{instanceId});
If an error occurs in communicating with EC2, the return value will be undef and $ec2->{error} will be populated with the message.
Product's homepage
Requirements:
· Perl