<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Richardandersonyaw on Medium]]></title>
        <description><![CDATA[Stories by Richardandersonyaw on Medium]]></description>
        <link>https://medium.com/@richardandersonyaw27?source=rss-3cec26fe717f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BBXUUqAoM5peKQkL</url>
            <title>Stories by Richardandersonyaw on Medium</title>
            <link>https://medium.com/@richardandersonyaw27?source=rss-3cec26fe717f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:54:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@richardandersonyaw27/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Bulletproof, Zero-Touch Automated Cloud Backup Pipeline on AWS]]></title>
            <link>https://medium.com/@richardandersonyaw27/building-a-bulletproof-zero-touch-automated-cloud-backup-pipeline-on-aws-d4b176f4f6c1?source=rss-3cec26fe717f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4b176f4f6c1</guid>
            <dc:creator><![CDATA[Richardandersonyaw]]></dc:creator>
            <pubDate>Sat, 21 Nov 2026 20:36:28 GMT</pubDate>
            <atom:updated>2026-11-21T20:36:28.051Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How to design an immutable, isolated, and serverless disaster recovery architecture using VPC Endpoints, Least-Privilege IAM, S3, AWS Lambda, and DynamoDB.</em></p><h3>Introduction &amp; Real-World Scenario</h3><p>In modern enterprise cloud engineering, disaster recovery and data immutability are mission-critical. Ransomware operators and disgruntled actors frequently target backup repositories first: if an attacker compromises an application server, their very next step is usually wiping out backup archives to ensure the organization has no fallback.</p><p>To counter this, we designed and built an end-to-end, zero-touch automated backup and audit pipeline on Amazon Web Services (AWS). The core mandate was simple yet stringent:</p><ol><li>The mission-critical application server must reside in a completely isolated private subnet with <strong>zero public IP addresses</strong> and no inbound internet exposure.</li><li>Backups must occur automatically and push archives directly into Amazon S3.</li><li>Crucially, the server must operate under strict <strong>write-only privileges</strong> — it can upload new backups, but is cryptographically prevented from deleting or overwriting historical archives.</li><li>Every backup upload must immediately trigger a serverless audit event that writes metadata into an immutable Amazon DynamoDB log table with zero human intervention.</li></ol><p>Here is an architectural walkthrough of how this pipeline was constructed, the engineering decisions behind it, the hurdles encountered, and how it translates to production enterprise environments.</p><h3>Architectural Breakdown &amp; Core Components</h3><pre>[ User (Local / Phone) ]</pre><pre>│ (SSH)</pre><pre>▼</pre><pre>[ Bastion Host ] ──── (Private SSH) ────► [ Private App Server ]</pre><pre>(Public Subnet)                           (Private Subnet: No Public IP)</pre><pre>│</pre><pre>│ (Direct AWS Private Network)</pre><pre>▼</pre><pre>[ S3 Gateway VPC Endpoint ]</pre><pre>│</pre><pre>▼</pre><pre>[ Amazon S3 Bucket ]</pre><pre>(backups/* prefix)</pre><pre>│</pre><pre>│ (ObjectCreated:Put Event)</pre><pre>▼</pre><pre>[ AWS Lambda Function ]</pre><pre>│</pre><pre>▼</pre><pre>[ Amazon DynamoDB ]</pre><pre>(Table: backup-log)</pre><p>The system is deliberately segmented into decoupled, single-responsibility layers:</p><ul><li><strong>VPC Isolation (10.0.0.0/16):</strong> Network segmentation separates ingress management from workload execution. The Bastion Host lives in the public subnet, while the App Server sits inside a private subnet (10.0.2.0/24) without an allocated public IPv4 address or an Internet Gateway route.</li><li><strong>Bastion Jump Host:</strong> Serves as a tightly monitored perimeter gatekeeper. It accepts SSH strictly from authorized administrator IPs (never 0.0.0.0/0), allowing administrative access into the private app server via SSH Agent Forwarding (ssh -A). This ensures private .pem keys never reside on the bastion filesystem.</li><li><strong>Temporary NAT Gateway:</strong> Used strictly during provisioning to download dependencies and utilities, then immediately decommissioned to eliminate hourly infrastructure overhead and enforce total outbound isolation.</li><li><strong>S3 Gateway VPC Endpoint:</strong> Routes backup traffic from the private subnet route table directly to AWS S3 across Amazon’s internal network spine. It operates with zero data transfer fees, zero hourly cost, and eliminates public internet exposure entirely.</li><li><strong>Least-Privilege IAM Role:</strong> An EC2 Instance Profile attached directly to the app server granting strictly s3:PutObject on arn:aws:s3:::YOUR-BUCKET/backups/*. No long-lived AWS secret access keys are stored on the server.</li><li><strong>Systemd &amp; Cron Automation:</strong> A native systemd service (data-generator.service) generates ongoing application transaction logs, while a resilient shell script (backup.sh) executed by cron creates compressed archives and uploads them to S3.</li><li><strong>Event-Driven Serverless Audit (S3 →\rightarrow→ Lambda →\rightarrow→ DynamoDB):</strong> Whenever S3 receives a new backup object under backups/, it fires an ObjectCreated event. A Python-based AWS Lambda function extracts the object key, byte size, bucket name, and timestamp, instantly appending an audit record into DynamoDB.</li></ul><h3>Why IAM Roles and VPC Endpoints Outperform Legacy Setups</h3><p>Two foundational security decisions define this architecture:</p><h3>1. IAM Instance Roles vs. Hardcoded Access Keys</h3><p>Storing long-term static AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) on virtual machines is one of the leading causes of enterprise cloud breaches. If an attacker gains shell access or reads configuration files, those keys can be exfiltrated and abused remotely.</p><p>By attaching an <strong>IAM Role</strong> to the EC2 instance, AWS Security Token Service (STS) dynamically generates short-lived, auto-rotating credentials accessible only through the Instance Metadata Service (IMDSv2). Furthermore, scoping the policy strictly to s3:PutObject ensures that even a root user on the server cannot execute aws s3 rm or aws s3 sync --delete.</p><h3>2. S3 Gateway VPC Endpoints vs. NAT Gateways</h3><p>While a NAT Gateway allows private instances to reach the internet, it introduces two distinct drawbacks:</p><ul><li><strong>Cost:</strong> NAT Gateways incur a continuous hourly charge (~$0.045/hr) plus data processing rates (~$0.045/GB), which scales aggressively with frequent multi-gigabyte database backups.</li><li><strong>Attack Surface:</strong> Routing S3 backups over a NAT Gateway leaves outbound internet routes open.</li></ul><p>An <strong>S3 Gateway VPC Endpoint</strong> is completely free, keeps traffic entirely within AWS’s high-throughput private fiber backbones, and allows administrators to safely tear down default outbound routes (0.0.0.0/0), proving mathematically that data cannot leave the VPC toward unauthorized external servers.</p><h3>Implementation Process &amp; Challenges Overcome</h3><p>Building this pipeline involved several practical engineering challenges:</p><ol><li><strong>SSH Timeouts &amp; Security Group Drift:</strong> During initial bastion connectivity, connection timeouts occurred due to dynamic public IP changes from home network providers. Restricting inbound rules to current IP blocks (/32) and ensuring the public route table had an active Internet Gateway route resolved this immediately.</li><li><strong>Amazon Linux 2023 vs. Legacy Conventions:</strong> Transitioning from Ubuntu environments to Amazon Linux 2023 required adapting to the native ec2-user login principal and utilizing modern systemd units alongside pre-packaged AWS CLI v2 tools.</li><li><strong>The “Blackhole” Route Expectation:</strong> Deleting the temporary NAT Gateway intentionally resulted in an inactive blackhole route in the private route table. Verifying that curl -m 5 https://example.com failed while aws s3 cp succeeded provided conclusive proof that traffic was isolated to the internal VPC Endpoint.</li><li><strong>Lambda Scoping &amp; Permissions:</strong> The Lambda function execution role was granted strictly dynamodb:PutItem against the target table ARN alongside CloudWatch log generation permissions, adhering strictly to least-privilege standards.</li></ol><h3>Production Improvements for Enterprise Workloads</h3><p>If migrating this architecture into a Fortune 500 or regulated production environment, the following enhancements would be deployed:</p><ul><li><strong>S3 Object Lock (WORM Storage):</strong> Enabling Write-Once-Read-Many (WORM) retention in Compliance mode ensures that even AWS root account credentials cannot delete backups until a mandatory retention window expires.</li><li><strong>AWS KMS Customer Managed Keys (CMK):</strong> Encrypting backup objects with dedicated KMS keys with strict key policies prevents unauthorized decryption even if S3 bucket policies are accidentally loosened.</li><li><strong>S3 Lifecycle Rules:</strong> Transitioning older archives from S3 Standard to S3 Glacier Flexible Retrieval and Glacier Deep Archive after 30 and 90 days to minimize long-term storage expenditures.</li><li><strong>CloudWatch Alarms &amp; Dead Letter Queues (DLQ):</strong> Integrating SNS alerts for failed cron executions, disk capacity warnings, and Lambda DLQs to guarantee that unindexed backups immediately alert on-call engineering teams.</li></ul><h3>Conclusion</h3><p>This project demonstrates that robust cloud security and disaster recovery do not require complex, expensive commercial software. By combining AWS native networking constructs (VPC Endpoints), zero-trust identity policies (Least-Privilege IAM), and serverless event-driven compute (Lambda &amp; DynamoDB), we established a resilient, self-auditing backup pipeline that is immune to ransomware deletion and virtually cost-free to operate.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4b176f4f6c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Bastion Host and why the need for a bastion host ?]]></title>
            <link>https://medium.com/@richardandersonyaw27/what-is-bastion-host-and-why-the-need-for-a-bastion-host-25241e9a9186?source=rss-3cec26fe717f------2</link>
            <guid isPermaLink="false">https://medium.com/p/25241e9a9186</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[bastion-host]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Richardandersonyaw]]></dc:creator>
            <pubDate>Fri, 23 Oct 2026 20:57:59 GMT</pubDate>
            <atom:updated>2026-10-23T20:57:59.173Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Bastion Host and why the need for a bastion host ? A complete beginners guide with installation.</h3><p>Securing cloud infrastructure begins with network isolation. In public cloud environments, placing databases, application backends, or internal services directly on the public internet with open ports is an open invitation for automated bots and malicious actors.</p><p>In this article, I will walk you through how I designed and built a secure, production-grade two-tier network inside Amazon Web Services (AWS) using only free-tier resources — with zero NAT Gateway costs — and how I tackled the operational hurdles along the way.</p><p>Let’s breakdown the idea of bastion host concept in AWS with a simplified diagram to help us understand the concept better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ONqk-t4ZI6YkOG_JuhKkyg.png" /></figure><h3>Understanding a Bastion Host in AWS: A Simple Guide</h3><h3>1. What is a Bastion Host?</h3><p>Imagine having several servers running inside your AWS. These servers host your application, store data, or run background services. For security reasons, you don’t want these servers exposed to the general public directly for access. So how do you connect all your running servers together when you need to perform maintenance, troubleshooting an issue or patch an update? Do you isolate your servers and do it in isolation ? No, that when the bastion host becomes of use. The bastion host is specifically configured server <strong>where everyone who wants to access our AWS network or AWS resources has to go through private network. </strong>Instead of connecting directly to your private servers from your computer, you first connect to the bastion host and then use it to access those servers.</p><p><em>Picture it as a tunnel in middle of a heavily guarded castle to get to the castle you need to pass through the tunnel and this is a tunnel for doing all the security checks for us.</em></p><h3>2. Why Use a Bastion Host in AWS?</h3><p>A bastion host can offer several benefits:</p><ul><li><strong>Reduced exposure:</strong> Private servers do not need to be directly reachable from the public internet.</li><li><strong>Centralized access:</strong> Administrators have a designated entry point for remote management.</li><li><strong>Tighter access control:</strong> You can restrict which IP addresses can reach the bastion host and which servers it can access.</li><li><strong>Improved monitoring:</strong> You can collect logs and monitor administrative activity at the entry point, alongside logging on the private instances.</li><li><strong>Simplified administration:</strong> Multiple private servers can be accessed through a common, controlled route.</li></ul><h3>Step-by-Step Build Instructions</h3><h3>Step 1: Create the VPC, Subnets &amp; Internet Gateway</h3><ol><li><strong>Create the VPC:</strong></li></ol><ul><li>Go to <strong>VPC</strong> → <strong>Create VPC</strong>.</li><li>Select <strong>VPC only</strong>.</li><li>Name tag: Secure-TwoTier-VPC.</li><li>IPv4 CIDR: 10.0.0.0/16.</li><li>Click <strong>Create VPC</strong>.</li></ul><p><strong>2. Create Subnets in the Same Availability Zone:</strong></p><ul><li><strong>Public Subnet:</strong></li><li>VPC: Select Secure-TwoTier-VPC.</li><li>Subnet name: Public-Subnet-1a.</li><li>Availability Zone: Choose one (e.g., us-east-1a).</li><li>IPv4 CIDR: 10.0.1.0/24.</li><li><strong>Private Subnet:</strong></li><li>VPC: Select Secure-TwoTier-VPC.</li><li>Subnet name: Private-Subnet-1a.</li><li>Availability Zone: <strong>Must be the same AZ</strong> (e.g., us-east-1a).</li><li>IPv4 CIDR: 10.0.2.0/24.</li></ul><p><strong>3. Attach an Internet Gateway:</strong></p><ul><li>Go to <strong>Internet Gateways</strong> → <strong>Create internet gateway</strong>.</li><li>Name: TwoTier-IGW → click <strong>Create</strong>.</li><li>Click <strong>Actions</strong> → <strong>Attach to VPC</strong> → select Secure-TwoTier-VPC.</li></ul><p><strong>4. Configure Route Tables:</strong></p><ul><li><strong>Public Route Table:</strong></li><li>Go to <strong>Route Tables</strong> → <strong>Create route table</strong>.</li><li>Name: Public-RouteTable, VPC: Secure-TwoTier-VPC.</li><li>Select Public-RouteTable → tab <strong>Routes</strong> → <strong>Edit routes</strong>.</li><li>Add route: Destination 0.0.0.0/0, Target: <strong>Internet Gateway</strong> (TwoTier-IGW). Save changes.</li><li>Tab <strong>Subnet associations</strong> → <strong>Edit subnet associations</strong> → check Public-Subnet-1a → Save.</li><li><strong>Private Route Table:</strong></li><li>Create another route table: Private-RouteTable, VPC: Secure-TwoTier-VPC.</li><li>Leave routes as default (10.0.0.0/16 -&gt; local). <em>(Do not add a NAT Gateway)</em>.</li><li>Tab <strong>Subnet associations</strong> → associate Private-Subnet-1a → Save.</li></ul><p><strong>Configure Route Tables:</strong></p><ul><li><strong>Public Route Table:</strong></li><li>Go to <strong>Route Tables</strong> → <strong>Create route table</strong>.</li><li>Name: Public-RouteTable, VPC: Secure-TwoTier-VPC.</li><li>Select Public-RouteTable → tab <strong>Routes</strong> → <strong>Edit routes</strong>.</li><li>Add route: Destination 0.0.0.0/0, Target: <strong>Internet Gateway</strong> (TwoTier-IGW). Save changes.</li><li>Tab <strong>Subnet associations</strong> → <strong>Edit subnet associations</strong> → check Public-Subnet-1a → Save.</li><li><strong>Private Route Table:</strong></li><li>Create another route table: Private-RouteTable, VPC: Secure-TwoTier-VPC.</li><li>Leave routes as default (10.0.0.0/16 -&gt; local). <em>(Do not add a NAT Gateway)</em>.</li><li>Tab <strong>Subnet associations</strong> → associate Private-Subnet-1a → Save.</li></ul><p><strong>Configure Route Tables:</strong></p><ul><li><strong>Public Route Table:</strong></li><li>Go to <strong>Route Tables</strong> → <strong>Create route table</strong>.</li><li>Name: Public-RouteTable, VPC: Secure-TwoTier-VPC.</li><li>Select Public-RouteTable → tab <strong>Routes</strong> → <strong>Edit routes</strong>.</li><li>Add route: Destination 0.0.0.0/0, Target: <strong>Internet Gateway</strong> (TwoTier-IGW). Save changes.</li><li>Tab <strong>Subnet associations</strong> → <strong>Edit subnet associations</strong> → check Public-Subnet-1a → Save.</li><li><strong>Private Route Table:</strong></li><li>Create another route table: Private-RouteTable, VPC: Secure-TwoTier-VPC.</li><li>Leave routes as default (10.0.0.0/16 -&gt; local). <em>(Do not add a NAT Gateway)</em>.</li><li>Tab <strong>Subnet associations</strong> → associate Private-Subnet-1a → Save.</li></ul><h3>Step 2: Create Security Groups (Chained Security)</h3><ol><li><strong>Create Bastion Security Group (</strong><strong>Bastion-SG):</strong></li></ol><ul><li>Go to <strong>EC2</strong> → <strong>Security Groups</strong> → <strong>Create security group</strong>.</li><li>Name: Bastion-SG, Description: Allow SSH from my IP.</li><li>VPC: Secure-TwoTier-VPC.</li><li><strong>Inbound Rules:</strong></li><li>Type: SSH (Port 22)</li><li>Source: Select <strong>My IP</strong> (AWS automatically populates your.public.ip.address/32).</li><li>Click <strong>Create security group</strong>. Note down the Group ID (e.g., sg-0123456789abcdef0).</li></ul><ol><li><strong>Create Private Security Group (</strong><strong>Private-Instance-SG):</strong></li></ol><ul><li>Click <strong>Create security group</strong>.</li><li>Name: Private-Instance-SG, Description: Allow SSH only from Bastion SG.</li><li>VPC: Secure-TwoTier-VPC.</li><li><strong>Inbound Rules:</strong></li><li>Type: SSH (Port 22)</li><li>Source: Type or select the ID of Bastion-SG (e.g., sg-0123456789abcdef0). <em>Do not enter an IP address.</em></li><li>Click <strong>Create security group</strong>.</li></ul><h3>Step 3: Launch EC2 Instances (Free Tier)</h3><p>Create or use an existing key pair (e.g., my-aws-key.pem).</p><ol><li><strong>Launch Bastion Host:</strong></li></ol><ul><li>Go to <strong>EC2</strong> → <strong>Launch Instance</strong>.</li><li>Name: Bastion-Host.</li><li>AMI: <strong>Amazon Linux 2023</strong> (or Amazon Linux 2 / Ubuntu 22.04 LTS).</li><li>Instance Type: t2.micro or t3.micro (Free tier eligible).</li><li>Key pair: Select my-aws-key.</li><li><strong>Network settings</strong> (Click <em>Edit</em>):</li><li>VPC: Secure-TwoTier-VPC.</li><li>Subnet: Public-Subnet-1a.</li><li>Auto-assign Public IP: <strong>Enable</strong>.</li><li>Security groups: Select existing security group → Bastion-SG.</li><li>Launch instance.</li></ul><p><strong>Launch Private VM:</strong></p><ul><li>Click <strong>Launch Instance</strong>.</li><li>Name: Private-Instance.</li><li>AMI: Same as Bastion (e.g., <strong>Amazon Linux 2023</strong>).</li><li>Instance Type: t2.micro or t3.micro.</li><li>Key pair: Select the same my-aws-key.</li><li><strong>Network settings</strong> (Click <em>Edit</em>):</li><li>VPC: Secure-TwoTier-VPC.</li><li>Subnet: Private-Subnet-1a.</li><li>Auto-assign Public IP: <strong>Disable</strong>.</li><li>Security groups: Select existing security group → Private-Instance-SG.</li><li>Launch instance.</li></ul><h3>Step 4: Connect to the Private VM</h3><p>Never copy your .pem key onto the bastion. Use one of these two standard methods:</p><h4>Method 1: SSH ProxyJump (ssh -J) — Recommended</h4><p>This tunnels your connection automatically through the bastion in a single command.</p><pre>bash<br># Set key permissions (Linux/macOS/Git Bash)<br>chmod 400 my-aws-key.pem<br># Connect using ProxyJump<br>ssh -i my-aws-key.pem -J ec2-user@&lt;BASTION_PUBLIC_IP&gt; ec2-user@&lt;PRIVATE_INSTANCE_PRIVATE_I<br># If using Ubuntu, replace ec2-user with ubuntu).</pre><p><strong>On Linux / macOS:</strong></p><pre>bash<br>eval &quot;$(ssh-agent -s)&quot;<br>ssh-add ~/.ssh/my-aws-key.pem<br>ssh -A ec2-user@&lt;BASTION_PUBLIC_IP&gt;<br># Once logged in on the Bastion:<br>ssh ec2-user@&lt;PRIVATE_INSTANCE_PRIVATE_IP&gt;</pre><h3>4. Problem I Encountered and How I Solved Them</h3><p>Building cloud architectures always brings a few surprises. Here were the main roadblocks I faced and their solutions:</p><p><strong>Attempting to Enter an IP for the Private Security Group:</strong></p><ul><li><em>Problem:</em> Initially, I instinctively tried entering the Bastion’s private IP (10.0.1.x/32) into the inbound rule of the private security group.</li><li><em>Fix:</em> While this works temporarily, it’s brittle. If the bastion is rebuilt or replaced, the rule breaks. I realized AWS allows entering the <strong>Security Group ID</strong> (sg-xxxx) directly into the &quot;Source&quot; field. This dynamic referencing is far more resilient and adheres to AWS best practices.</li></ul><h3>5. Final Takeaway</h3><p>Building a secure two-tier network without relying on costly managed services like NAT Gateways proves that strong security is driven by solid architecture, not an expensive bill</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25241e9a9186" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>