1Rex::Box::Amazon(3) User Contributed Perl Documentation Rex::Box::Amazon(3)
2
3
4
6 Rex::Box::Amazon - Rex/Boxes Amazon Module
7
9 This is a Rex/Boxes module to use Amazon EC2.
10
12 To use this module inside your Rexfile you can use the following
13 commands.
14
15 use Rex::Commands::Box;
16 set box => "Amazon", {
17 access_key => "your-access-key",
18 private_access_key => "your-private-access-key",
19 region => "ec2.eu-west-1.amazonaws.com",
20 zone => "eu-west-1a",
21 authkey => "default",
22 };
23
24 task "prepare_box", sub {
25 box {
26 my ($box) = @_;
27
28 $box->name("mybox");
29 $box->ami("ami-c1aaabb5");
30 $box->type("m1.large");
31
32 $box->security_group("default");
33
34 $box->auth(
35 user => "root",
36 password => "box",
37 );
38
39 $box->setup("setup_task");
40 };
41 };
42
43 If you want to use a YAML file you can use the following template.
44
45 type: Amazon
46 amazon:
47 access_key: your-access-key
48 private_access_key: your-private-access-key
49 region: ec2.eu-west-1.amazonaws.com
50 zone: eu-west-1a
51 auth_key: default
52 vms:
53 vmone:
54 ami: ami-c1aaabb5
55 type: m1.large
56 security_group: default
57 setup: setup_task
58
59 And then you can use it the following way in your Rexfile.
60
61 use Rex::Commands::Box init_file => "file.yml";
62
63 task "prepare_vms", sub {
64 boxes "init";
65 };
66
68 See also the Methods of Rex::Box::Base. This module inherits all
69 methods of it.
70
71 new(name => $vmname)
72 Constructor if used in OO mode.
73
74 my $box = Rex::Box::VBox->new(name => "vmname");
75
76 ami($ami_id)
77 Set the AMI ID for the box.
78
79 type($type)
80 Set the type of the Instance. For example "m1.large".
81
82 security_group($sec_group)
83 Set the Amazon security group for this Instance.
84
85 forward_port(%option)
86 Not available for Amazon Boxes.
87
88 share_folder(%option)
89 Not available for Amazon Boxes.
90
91 info
92 Returns a hashRef of vm information.
93
94
95
96perl v5.36.1 2023-08-07 Rex::Box::Amazon(3)