1VM::EC2::REST::securityU_sgerrouCpo(n3t)ributed Perl DocVuMm:e:nEtCa2t:i:oRnEST::security_group(3)
2
3
4

NAME VM::EC2::REST::security_group

SYNOPSIS

7        use VM::EC2 ':standard';
8

METHODS

10       The methods in this section allow you to query and manipulate security
11       groups (firewall rules). See VM::EC2::SecurityGroup for functionality
12       that is available through these objects.
13
14       Implemented:
15        AuthorizeSecurityGroupEgress (EC2-VPC only)
16        AuthorizeSecurityGroupIngress
17        CreateSecurityGroup
18        DeleteSecurityGroup
19        DescribeSecurityGroups
20        RevokeSecurityGroupEgress (EC2-VPC only)
21        RevokeSecurityGroupIngress
22
23       Unimplemented:
24        (none)
25
26   @sg = $ec2->describe_security_groups(@group_ids)
27   @sg = $ec2->describe_security_groups(%args);
28   @sg = $ec2->describe_security_groups(\%filters);
29       Searches for security groups (firewall rules) matching the provided
30       filters and return a series of VM::EC2::SecurityGroup objects.
31
32       In the named-argument form you can provide the following optional
33       arguments:
34
35        -group_name      A single group name or an arrayref containing a list
36                          of names
37
38        -name            Shorter version of -group_name
39
40        -group_id        A single group id (i.e. 'sg-12345') or an arrayref
41                          containing a list of ids
42
43        -filter          Filter on tags and other attributes.
44
45       The -filter argument name can be omitted if there are no other
46       arguments you wish to pass.
47
48       The full list of security group filters can be found at:
49       http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSecurityGroups.html
50
51   $group = $ec2->create_security_group(-group_name=>$name,
52       -group_description=>$description, -vpc_id     => $vpc_id )
53       Create a security group. Arguments are:
54
55        -group_name              Name of the security group (required)
56        -group_description       Description of the security group (required)
57        -vpc_id                  Virtual private cloud security group ID
58                                  (required for VPC security groups)
59
60       For convenience, you may use -name and -description as aliases for
61       -group_name and -group_description respectively.
62
63       If succcessful, the method returns an object of type
64       VM::EC2::SecurityGroup.
65
66   $boolean = $ec2->delete_security_group($group_id)
67   $boolean = $ec2->delete_security_group(-group_id   => $group_id,
68       -group_name => $name);
69       Delete a security group. Arguments are:
70
71        -group_name              Name of the security group
72        -group_id                ID of the security group
73
74       Either -group_name or -group_id is required. In the single-argument
75       form, the method deletes the security group given by its id.
76
77       If succcessful, the method returns true.
78
79   $boolean = $ec2->update_security_group($security_group)
80       Add one or more incoming firewall rules to a security group. The rules
81       to add are stored in a VM::EC2::SecurityGroup which is created either
82       by describe_security_groups() or create_security_group(). This method
83       combines the actions AuthorizeSecurityGroupIngress,
84       AuthorizeSecurityGroupEgress, RevokeSecurityGroupIngress, and
85       RevokeSecurityGroupEgress.
86
87       For details, see VM::EC2::SecurityGroup. Here is a brief summary:
88
89        $sg = $ec2->create_security_group(-name=>'MyGroup',-description=>'Example group');
90
91        # TCP on port 80 for the indicated address ranges
92        $sg->authorize_incoming(-protocol  => 'tcp',
93                                -port      => 80,
94                                -source_ip => ['192.168.2.0/24','192.168.2.1/24'});
95
96        # TCP on ports 22 and 23 from anyone
97        $sg->authorize_incoming(-protocol  => 'tcp',
98                                -port      => '22..23',
99                                -source_ip => '0.0.0.0/0');
100
101        # ICMP on echo (ping) port from anyone
102        $sg->authorize_incoming(-protocol  => 'icmp',
103                                -port      => -1,
104                                -source_ip => '0.0.0.0/0');
105
106        # TCP to port 25 (mail) from instances belonging to
107        # the "Mail relay" group belonging to user 12345678.
108        $sg->authorize_incoming(-protocol  => 'tcp',
109                                -port      => 25,
110                                -group     => '12345678/Mail relay');
111
112        $result = $ec2->update_security_group($sg);
113
114       or more simply:
115
116        $result = $sg->update();
117

SEE ALSO

119       VM::EC2
120

AUTHOR

122       Lincoln Stein <lincoln.stein@gmail.com>.
123
124       Copyright (c) 2011 Ontario Institute for Cancer Research
125
126       This package and its accompanying libraries is free software; you can
127       redistribute it and/or modify it under the terms of the GPL (either
128       version 1, or at your option, any later version) or the Artistic
129       License 2.0.  Refer to LICENSE for the full license text. In addition,
130       please see DISCLAIMER.txt for disclaimers of warranty.
131
132
133
134perl v5.30.1                      2020-02-07  VM::EC2::REST::security_group(3)
Impressum