code: def authorize_role(self, role, protocol, from_port, to_port, cidr_ip):
      
      if (protocol != 'tcp' and protocol != 'udp'):
        raise RuntimeError('error: expected protocol to be tcp or udp '\
                           'but got %s' % (protocol))
      
      self._check_role_name(role)
      role_group_name = self._group_name_for_role(role)
      # Revoke first to avoid InvalidPermission.Duplicate error
      self.ec2.revoke_security_group(role_group_name,
                                               ip_protocol=protocol,
                                               from_port=from_port,
                                               to_port=to_port, cidr_ip=cidr_ip)
      self.ec2.authorize_security_group(role_group_name,
                                                  ip_protocol=protocol,
                                                  from_port=from_port,
                                                  to_port=to_port,
                                                  cidr_ip=cidr_ip)
docs: Authorize access to machines in a given role from a given network.