VM::EC...::Entry(3pm)

πŸ“¦
version 1.28 Β· 7 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– VM::EC2::VPC::NetworkAcl::Entry β€” ok so bestie, let's talk network ACL entries πŸ’–

This is the page for VM::EC2::VPC::NetworkAcl::Entry(3pm), straight out of the User Contributed Perl Documentation. It's giving very specific, very powerful, very "your VPC firewall rules but make it an object" energy. Let's get into it. ✨


🌸 NAME 🌸

VM::EC2::VPC::NetworkAcl::Entry β€” a VPC Network ACL entry. That's it, that's the whole vibe. One entry, one rule, one little bouncer for your subnet traffic. 🫢


✨ SYNOPSIS ✨

Okay so here's how you actually use it, no cap:

  use VM::EC2;

my $ec2      = VM::EC2->new(...);
my $acl      = $ec2->describe_network_acls(-network_acl_id=>'acl-12345678');
my @entries  = $acl->entries;

# print outgoing icmp rules
for my $e (@entries) {
    if ($e->egress && $e->protocol == 1) {  # icmp = 1
        print $e->ruleNumber,"\n",
              $e->ruleAction,"\n",
              $e->cidrBlock,"\n",
              $e->icmpType,"\n",
              $e->icmpCode,"\n";
    }
}

# print incoming tcp rules
for my $e (@entries) {
    if (! $e->egress && $e->protocol == 6) {  # tcp = 6
        print $e->ruleNumber,"\n",
              $e->ruleAction,"\n",
              $e->cidrBlock,"\n",
              $e->port_from,'-',$e->port_to,"\n";
    }
}

Like, you spin up a VM::EC2 object, grab your ACL by its -network_acl_id, pull the entries, and then loop through them filtering on egress and protocol. ICMP is 1, TCP is 6, iykyk. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

This object represents an Amazon EC2 VPC network ACL entry. That's the whole thing β€” it's the lil object wrapper for one single rule inside a network ACL. Main character energy for a firewall rule, honestly. πŸ‘‘


πŸŽ€ METHODS πŸŽ€

These object methods are supported β€” every single one, we're not skipping anybody:

  • ruleNumber β€” the specific rule number for the entry. Heads up bestie, ACL entries are processed in ascending order by rule number, so the order literally matters. πŸ”’
  • protocol β€” the protocol. A value of -1 means all protocols. There's a whole list at http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml if you wanna go look up protocol numbers, which, honestly, iconic of you. 🌈
  • ruleAction β€” whether to allow or deny the traffic that matches the rule. Valid values: allow | deny. It's giving yes or no, no in-between. βš–οΈ
  • egress β€” boolean flag to indicate an egress rule (rule is applied to traffic leaving the subnet). A value of true indicates egress. πŸšͺ
  • cidrBlock β€” the network range to allow or deny, in CIDR notation. 🧚
  • icmpType β€” for the ICMP protocol, this is the ICMP type.
  • icmpCode β€” for the ICMP protocol, this is the ICMP code.
  • portRangeFrom β€” for the TCP or UDP protocols, the starting range of ports the rule applies to.
  • portRangeTo β€” for the TCP or UDP protocols, the ending range of ports the rule applies to.
  • port_from β€” alias for portRangeFrom. Same thing, cuter name. πŸ’–
  • port_to β€” alias for portRangeTo. Also same thing, also cuter name. πŸ’–

The object also supports the tags() method described in VM::EC2::Generic β€” so yes, you can tag it, go off. 🏷️


πŸ’€ STRING OVERLOADING πŸ’€

When used in a string context, this object will interpolate the rule number. So if you just shove it into a string, boom, you get the rule number. That's it. Not me being obsessed with a one-line feature but here we are. 🫠


🌟 SEE ALSO 🌟

Go read these too, besties:

VM::EC2 VM::EC2::Generic VM::EC2::Tag VM::EC2::VPC VM::EC2::VPC::NetworkAcl


πŸ‘‘ AUTHOR πŸ‘‘

Lance Kinley <lkinley@loyaltymethods.com>.

Copyright (c) 2012 Loyalty Methods, Inc.

This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.

fr fr read the LICENSE and DISCLAIMER.txt, they're the receipts. 🧾

And that's the whole page, bestie β€” this one shipped with perl v5.38.2 and it's dated 2024-08-10. Go forth and rule your subnets. Slay. πŸ’…βœ¨

πŸ“¦ where this page comes from