Skip to content
hannctl.
PDF ↓
← All work
07 / PF-09 · AWS · Python Operations automation · Cloud security

AWS firewall request automation.

A CLI that checks whether a firewall request is already open, previews changes only for what is blocked, and verifies the real traffic.

PERIOD
Personal project · released Nov 2026
MY ROLE
Design and implementation
TOOLS & CONTEXT
Python · boto3 · AWS · CloudWatch Logs · Athena · Excel — 3-step CLI · 4 input formats · 4 resource types
Firewall requestSource · Destination · Portnetops confirmnetops modifynetops flowlogIs it already open?Preview only the blocked flowsVerify with real trafficOpenNo work neededBlockedOn to the next stepPreviewPrints affected resources andrules--apply + typed applyAdds rules onlyTraffic foundCloudWatch Logs · AthenaNothing changes by default
flowlog searches CloudWatch Logs or Athena for the actual traffic.
01 / CONTEXT

Problem

Firewall requests often asked for flows that were already open, which added duplicate rules, and finding the related resources and rules meant searching the console account by account.

02 / DECISIONS

Approach

netops confirm resolves addresses to AWS resources and evaluates security group rules and routes. Only blocked flows go to modify, which prints a plan first. flowlog searches CloudWatch Logs or Athena for the actual traffic.

03 / ENGINEERING

Implementation

  • Python
  • boto3
  • AWS
  • CloudWatch Logs
  • Athena
  • Excel

Scale · 3-step CLI · 4 input formats · 4 resource types

FLOW / 05
Firewall requestSource · Destination · Portnetops confirmnetops modifynetops flowlogIs it already open?Preview only the blocked flowsVerify with real traffic

A request comes in as source, destination, and port.

01 / 05
Read every step
  1. A request comes in as source, destination, and port.
  2. confirm evaluates rules and routes. Flows already open need no work.
  3. Only blocked flows reach modify. By default it just prints a plan.
  4. Rules are added only with --apply and a typed apply. The tool can only add rules.
  5. flowlog searches CloudWatch Logs or Athena for the actual traffic.
AddressIP · CIDR · IP range ·RDS addressResolveEC2 · LB · RDS · ENISource outboundRule checkDestination inboundRule checkRoute checkWhen the destination isoutside AWSVerdict: blocked (Route needed)Separates cases that a new rule cannot fixRules and routes are read together to avoid needless allow rules
The verdict names the cause, such as Security group rule needed or Route needed.
04 / VERIFICATION

Result

By default nothing changes. Adding a rule needs --apply and a typed apply, rules can only be added, and a security group without free slots is never chosen.

3
Steps: confirm, modify, flowlog
4
Input formats
4
Resource types identified
05 / REFLECTION

What I learned

In a change tool, the safe action has to be the default that needs no flag. With --dry-run, one forgotten flag means a real change, but when the default run changes nothing and applying needs both --apply and a typed apply, a mistake never becomes a change. Narrowing changes to adding rules only follows the same idea: the less a tool can do, the less harm it can cause when it is wrong. And instead of opening a rule as soon as a request arrives, checking first whether the path is already open, and recording whether a block comes from a rule or a route, stopped duplicate rules from piling up and left only the changes that were really needed.

OUTCOME

3 steps — confirm · modify · flowlog

Public repo: pf-09-aws-netops-firewall-automation ↗

Related field notes

NEXT / Woori FIS · AWS · Security Woori Financial Group AWS security architecture

Search the site

Quick links ↑ ↓ move · Enter open · Esc close

Choose a theme

Click a badge to switch to that theme on the same content. Dragging only swings it.

Back to the front page →