Manage EC2 Security Groups
mainMolecule EC2 can use existing security groups or create new ones using the amazon.aws.ec2_group plugin.
- Use existing groups: Provide a list of names in the
security_groupsoption. - Create a new group: Provide
security_group_nameandsecurity_group_description. Note that specifying a name will cause a new group to be created with that name, replacing any existing group of that name.
Customizing rules:
Use security_group_rules (ingress) and security_group_rules_egress (egress) to define rules. If no rules are specified and a new group is created, the default behavior is to allow incoming SSH and ICMP, and all outgoing traffic.
Rule parameters (passed to ec2_group):
proto: Protocol (e.g.,tcp,udp,all).from_port/to_port: Port range.cidr_ip/cidr_ipv6: IP ranges.group_name: For referencing other groups.rule_desc: Description of the rule.
platforms:
- name: debian_specify_sg
image: ami-0f31df35880686b3f
region: us-east-1
security_group_name: mole-whacked
security_group_description: Trying harder than we've tried before
security_group_rules:
- proto: all
group_name: vpn
rule_desc: only allow access from the VPN
security_group_rules_egress:
- proto: tcp
from_port: 80
to_port: 80
cidr_ip: "0.0.0.0/0"
rule_desc: only allow old school web browsing