4. East-West

Test cases 2 and 7: traffic between PROD and QA is inspected through send-via, and access follows AWS tags.

What you will see

4.1 Launch two demo instances

A demo instance is a canary without its tags, so no policy admits it. Its launch template fixes the subnet: the canary subnet of PROD or QA, in one AZ of your region. A launch cannot change it. The AZ does not decide which member inspects a flow: the GWLB balances across all AZs.

  1. In CloudShell, launch one instance in PROD and one in QA:

    aws ec2 run-instances --launch-template LaunchTemplateName=$PREFIX-prod-demo --query 'Instances[0].InstanceId' --output text
    aws ec2 run-instances --launch-template LaunchTemplateName=$PREFIX-qa-demo --query 'Instances[0].InstanceId' --output text
    
  2. In CloudShell, keep their IDs and list their addresses. Run this block again after CloudShell restarts:

    PROD_ID=$(aws ec2 describe-instances --filters Name=tag:Name,Values=$PREFIX-prod-demo Name=instance-state-name,Values=pending,running --query 'Reservations[].Instances[].InstanceId' --output text)
    QA_ID=$(aws ec2 describe-instances --filters Name=tag:Name,Values=$PREFIX-qa-demo Name=instance-state-name,Values=pending,running --query 'Reservations[].Instances[].InstanceId' --output text)
    aws ec2 describe-instances --instance-ids $PROD_ID $QA_ID \
      --query 'Reservations[].Instances[].[Tags[?Key==`Name`]|[0].Value,InstanceId,PrivateIpAddress,Placement.AvailabilityZone]' \
      --output table
    

    Note the QA address, <qa-ip>, and the PROD address, <prod-ip>.

  3. In EC2, Instances, open a Session Manager session on each: select the instance, Connect, Session Manager, Connect. These are your PROD session and QA session.

  4. In each session, start bash. In the PROD session, also set the QA address:

    bash
    
    QA_IP=<qa-ip>
    

Each instance serves HTTP on port 80.

4.2 A denied flow

  1. In the PROD session, probe QA once a second:

    while true; do printf '%s ' "$(date +%T)"; curl -s -o /dev/null -m 2 -w '%{http_code}\n' http://$QA_IP/; sleep 1; done
    

    Each line ends in 000: no answer.

  2. On FortiAnalyzer, Log View, FortiGate, Traffic, filter on dstip=<qa-ip>: the flow is denied by policy 0, the implicit deny.

Leave the probe running.

4.3 Open it by tag

  1. In CloudShell, tag the PROD instance:

    aws ec2 create-tags --resources $PROD_ID --tags Key=Allow-To-QA,Value=local
    
  2. In the PROD session, the lines end in 200 within about a minute.

  3. On FortiAnalyzer, the flow is now accepted by the policy <prefix>-ew-to-qa.

  4. On FortiManager, Policy & Objects, open the East-West package. The source of that policy is the dynamic address <prefix>-allow-to-qa, with the filter Tag.Allow-To-QA=local | Tag.Allow-To-QA=all. Nothing in the policy changed.

The FortiGates read the tags through their AWS SDN connector every 60 s.

4.4 Terminate a member under a running flow

FGSP copies each firewall session to the other members, and the GWLB moves the flows of a failed member to a healthy one.

  1. In the PROD session, stop the probe with Ctrl+C.

  2. In the QA session, replace the HTTP listener with one that prints what it receives:

    sudo systemctl stop canary-http
    sudo python3 -c 'import socket;s=socket.socket();s.setsockopt(1,2,1);s.bind(("",80));s.listen();c,_=s.accept();[print(l.decode().strip(),flush=True) for l in c.makefile("rb")]'
    
  3. In the PROD session, open one TCP connection and send the time every second:

    exec 3<>/dev/tcp/$QA_IP/80; while date +%T >&3; do date +%T; sleep 1; done
    

    The QA session prints the same times. This is one flow.

  4. In CloudShell, list the East-West members:

    aws ec2 describe-instances --filters Name=tag:Name,Values=$PREFIX-ew-fgt Name=instance-state-name,Values=running \
      --query 'Reservations[].Instances[].[InstanceId,PublicIpAddress,Placement.AvailabilityZone]' --output table
    
  5. On your laptop, open SSH to each member, ssh admin@<member-address>, and look for the flow:

    diagnose sys session filter clear
    diagnose sys session filter dst <qa-ip>
    diagnose sys session filter dport 80
    diagnose sys session list
    

    The owner shows the firewall session with the flag synced; the other members hold a copy flagged syn_ses. The owner's instance ID is <member-id> in the table.

  6. In CloudShell, terminate the owner:

    aws ec2 terminate-instances --instance-ids <member-id>
    
  7. In the QA session, the times continue. Another member now carries the flow.

  8. In EC2, Auto Scaling groups, <prefix>-ew-fgt, Activity, the group launches a replacement. It turns healthy in the target group about 6 minutes later, once FortiManager has installed its configuration.

  9. In both sessions, stop the flow with Ctrl+C. Then restore the listener in the QA session:

    sudo systemd-run --unit=canary-http python3 -m http.server 80 --directory /srv
    

4.5 Inter-region

The eu-west-1 East-West cluster inspects traffic between the two regions, in both directions. Work with the other attendee.

  1. In CloudShell, tag your PROD instance:

    aws ec2 create-tags --resources $PROD_ID --tags Key=Allow-To-Prod,Value=remote
    
  2. Exchange PROD addresses with the other attendee. In the PROD session, probe theirs:

    curl -s -o /dev/null -m 2 -w '%{http_code}\n' http://<their-prod-ip>/
    

    The answer is 200 within about a minute of your tag. The tag on the source decides; their instance needs none.

  3. On the eu-west-1 FortiAnalyzer, Log View, FortiGate, Traffic, the eu-west-1 East-West members log both directions on the inter-region policies.

Check

Limits

Where to look

What Where
Allowed and denied flows FortiAnalyzer, Log View, FortiGate, Traffic
Policies and dynamic addresses FortiManager, Policy & Objects
Replacement EC2, Auto Scaling groups, <prefix>-ew-fgt, Activity
Target health EC2, Target groups, <prefix>-ew, Targets
Send-via Network Manager, Core network, Policy versions
Background probes CloudWatch, dashboard CloudCanaries-Region-<region>
← 3. Trusted source5. North-South →