methods/ec_common.rb
# Add egress rule to AWS EC2 security group
Add egress rule to AWS EC2 security group
Add egress rule to AWS EC2 security group
def remove_egress_rule_from_aws_security_group(options)
  ec2 = initiate_aws_ec2_client(options)
  prefix_list_id = get_aws_prefix_list_id(options['access'],options['secret'],options['region'])
  handle_output(options,"Information:\tDeleting egress rule to security group #{options['group']} (Protocol: #{options['proto']} From: #{options['from']} To: #{options['to']} CIDR: #{options['cidr']})")
  ec2.revoke_security_group_egress({
    group_id: options['group'],
    ip_permissions: [
      {
        ip_protocol:  options['proto'],
        from_port:    options['from'],
        to_port:      options['to'],
        ip_ranges: [
          {
            cidr_ip: options['cidr'],
          },
        ],
      },
    ],
  })
  return
end
def remove_egress_rule_from_aws_security_group ( options ) ec2 = initiate_aws_ec2_client ( options ) prefix_list_id = get_aws_prefix_list_id ( options [ 'access' ] , options [ 'secret' ] , options [ 'region' ] ) handle_output ( options , "Information:\tDeleting egress rule to security group #{options['group']} (Protocol: #{options['proto']} From: #{options['from']} To: #{options['to']} CIDR: #{options['cidr']})" ) ec2 . revoke_security_group_egress ( { group_id : options [ 'group' ] , ip_permissions : [ { ip_protocol : options [ 'proto' ] , from_port : options [ 'from' ] , to_port : options [ 'to' ] , ip_ranges : [ { cidr_ip : options [ 'cidr' ] , } , ] , } , ] , } ) return end
Add egress rule to AWS EC2 security group
Add egress rule to AWS EC2 security group
options
<not_specific>