Debian Codegraph @

README

raw
1 This is an interface to Amazon EC2 REST tools that follows the
2 2014-05-01 API. I created it because I needed access to the Tag and
3 TagSet interfaces, and neither euca2ools nor Net::Amazon::EC2 provided
4 this functionality. Support for the following services are complete:
5
6 Elastic Compute Cloud (EC2)
7 Virtual Private Cloud (VPC)
8 Elastic Load Balancing (ELB) and Autoscaling
9 Relational Database Service (RDS)
10
11 The module is designed to work in a standard procedural manner, as
12 well as in an event-driven application using the AnyEvent framework.
13
14 The following code illustrates the object-oriented features of the
15 module:
16
17 # get new EC2 object
18 my $ec2 = VM::EC2->new(-access_key => 'access key id',
19 -secret_key => 'aws_secret_key',
20 -endpoint => 'http://ec2.amazonaws.com');
21
22 # fetch an image by its ID
23 my $image = $ec2->describe_images('ami-12345');
24
25 # get some information about the image
26 my $architecture = $image->architecture;
27 my $description = $image->description;
28 my @devices = $image->blockDeviceMapping;
29 for my $d (@devices) {
30 print $d->deviceName,"\n";
31 print $d->snapshotId,"\n";
32 print $d->volumeSize,"\n";
33 }
34
35 # run two instances
36 my @instances = $image->run_instances(-key_name =>'My_key',
37 -security_group=>'default',
38 -min_count =>2,
39 -instance_type => 't1.micro')
40 or die $ec2->error_str;
41
42 # wait for both instances to reach "running" or other terminal state
43 $ec2->wait_for_instances(@instances);
44
45 # print out both instance's current state and DNS name
46 for my $i (@instances) {
47 my $status = $i->current_status;
48 my $dns = $i->dnsName;
49 print "$i: [$status] $dns\n";
50 }
51
52 # tag both instances with Role "server"
53 foreach (@instances) {$_->add_tag(Role=>'server');
54
55 # stop both instances
56 foreach (@instances) {$_->stop}
57
58 $ec2->wait_for_instances(@instances); # wait till they stop
59
60 # create an image from both instance, tag them, and make them public
61 for my $i (@instances) {
62 my $img = $i->create_image("Autoimage from $i","Test image");
63 $img->add_tags(Name => "Autoimage from $i",
64 Role => 'Server',
65 Status=> 'Production');
66 $img->make_public(1);
67 }
68
69 Development and bug reports
70 ---------------------------
71
72 This module is supported using GitHub at
73 https://github.com/lstein/LibVM-EC2-Perl. To report a bug please open
74 the Issues tag and file a bug report using the "New Issue" button.
75
76 To contribute to development of this module, please obtain a github
77 account for yourself and then either:
78
79 1) Fork a copy of the repository, make your changes against this repository,
80 and send a pull request to me to incorporate your changes.
81
82 2) Contact me by email and ask for push privileges on the repository.
83
84 See http://help.github.com/ for help getting started.
85
86 Credits
87 -------
88
89 Many thanks to Lance Kinley, who contributed support for Network ACLs,
90 VPC VPNs, Elastic Load Balancing, RDS, and many smaller feature
91 enhancements as well as bug and documentation fixes.
92
93 Author
94 ------
95
96 Lincoln D. Stein <[email protected]>
97 13 September 2012
98
99
100