Connection module for Amazon Security Groups
New in version 2014.7.0.
This module accepts explicit ec2 credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
If IAM roles are not used you need to specify them either in a pillar or in the minion's config file:
secgroup.keyid: GKTADJGHEIQSXMKKRBJ08H
secgroup.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
A region may also be specified in the configuration:
secgroup.region: us-east-1
If a region is not specified, the default is us-east-1.
It's also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
boto
Add a new rule to an existing security group.
CLI Example:
salt myminion boto_secgroup.authorize mysecgroup ip_protocol=tcp from_port=80 to_port=80 cidr_ip='['10.0.0.0/8', '192.168.0.0/24']'
Given a list of security groups and a vpc_id, convert_to_group_ids will convert all list items in the given list to security group ids.
CLI Example:
salt myminion boto_secgroup.convert_to_group_ids mysecgroup vpc-89yhh7h
Create a security group.
CLI Example:
salt myminion boto_secgroup.create mysecgroup 'My Security Group'
Delete a security group.
CLI Example:
salt myminion boto_secgroup.delete mysecgroup
Deletes tags from a security group.
New in version 2016.3.0.
a list of tags to remove
the name of the security group
the group id of the security group (in lie of a name/vpc combo)
the name of the vpc to search the named group for
the id of the vpc, in lieu of the vpc_name
the amazon region
amazon key
amazon keyid
amazon profile
CLI Example:
salt myminion boto_secgroup.delete_tags ['TAG_TO_DELETE1','TAG_TO_DELETE2'] security_group_name vpc_id=vpc-13435 profile=my_aws_profile
Check to see if a security group exists.
CLI Example:
salt myminion boto_secgroup.exists mysecgroup
Return a list of all Security Groups matching the given criteria and filters.
Note that the groupnames
argument only functions correctly for EC2
Classic and default VPC Security Groups. To find groups by name in other
VPCs you'll want to use the group-name
filter instead.
The valid keys for the filters
argument can be found in AWS's API
documentation.
CLI Example:
salt myminion boto_secgroup.get_all_security_groups filters='{group-name: mygroup}'
Get the configuration for a security group.
CLI Example:
salt myminion boto_secgroup.get_config mysecgroup
Get a Group ID given a Group Name or Group Name and VPC ID
CLI Example:
salt myminion boto_secgroup.get_group_id mysecgroup
Remove a rule from an existing security group.
CLI Example:
salt myminion boto_secgroup.revoke mysecgroup ip_protocol=tcp from_port=80 to_port=80 cidr_ip='10.0.0.0/8'
Sets tags on a security group.
New in version 2016.3.0.
a dict of key:value pair of tags to set on the security group
the name of the security group
the group id of the security group (in lie of a name/vpc combo)
the name of the vpc to search the named group for
the id of the vpc, in lieu of the vpc_name
the amazon region
amazon key
amazon keyid
amazon profile
CLI Example:
salt myminion boto_secgroup.set_tags "{'TAG1': 'Value1', 'TAG2': 'Value2'}" security_group_name vpc_id=vpc-13435 profile=my_aws_profile