<?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 IKEAZOTA AUGUSTINE on Medium]]></title>
        <description><![CDATA[Stories by IKEAZOTA AUGUSTINE on Medium]]></description>
        <link>https://medium.com/@ikeaustine?source=rss-ce1b95aaae2d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fDsiXLtu8UrLn8nA</url>
            <title>Stories by IKEAZOTA AUGUSTINE on Medium</title>
            <link>https://medium.com/@ikeaustine?source=rss-ce1b95aaae2d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:11:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ikeaustine/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[How I Automated Desktop Wallpaper Deployment Across AWS Hybrid AD Using Group Policy]]></title>
            <link>https://medium.com/@ikeaustine/how-i-automated-desktop-wallpaper-deployment-across-aws-hybrid-ad-using-group-policy-9b02468beb95?source=rss-ce1b95aaae2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b02468beb95</guid>
            <dc:creator><![CDATA[IKEAZOTA AUGUSTINE]]></dc:creator>
            <pubDate>Mon, 11 May 2026 10:09:05 GMT</pubDate>
            <atom:updated>2026-05-11T14:28:48.750Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W92-VvYGg4nbFqPtNODANA.png" /></figure><p><em>A complete walkthrough for hybrid environments with VPN users, centralized logging, and smart hash-based optimization.</em></p><p>Deploying a company wallpaper sounds simple until you’re dealing with a hybrid environment where your users are connected with VPN, scripts silently fail, users desktop background turns black, desktop image not displaying upon deployment and Group Policy behaves differently across machines. This guide documents exactly how I solved it end-to-end: from creating the right folder structure in SYSVOL to writing a smart PowerShell script that only copies the wallpaper when something has actually changed.</p><p><strong>Environment </strong>This guide was built for Active Directory Domain Services hosted on AWS with VPN-connected users, using SYSVOL for script distribution and GPMC for policy management. Domain: your-domain.com</p><h4>Objective</h4><p>The goal is to automatically deploy a centralized desktop wallpaper to all domain-joined Windows computers using Group Policy without manual intervention, and with reliable execution for both office and remote/VPN users. The solution also includes centralized logging so you can verify which machines applied the wallpaper and when.</p><h4>Step 1: Create the Wallpaper Folder in SYSVOL</h4><p>SYSVOL is a special shared folder on every Domain Controller that replicates across all DCs automatically. It’s the right place to store logon scripts and assets that all domain machines need to access.</p><p>1 Log in to your Domain Controller.</p><p>2 Press Win + R and navigate to: C:\Windows\SYSVOL\sysvol</p><p>3 Open your domain folder: your-domain.com</p><p>4 Open the scripts subfolder.</p><p>5 Create a new folder named wallpaper.</p><p>Your final wallpaper folder path should be:</p><p>\\your-domain.com\SYSVOL\your-domain.com\scripts\wallpaper\</p><h4>Step 2: Add and Name the Wallpaper File</h4><p>1 Copy your wallpaper image into the wallpaper folder you just created.</p><p>2 Rename the file to company-wallpaper.jpg.</p><blockquote><strong>Important Naming Rules </strong>Always use JPG format. Keep the filename simple no spaces. Spaces in filenames are a common cause of silent failures in logon scripts.</blockquote><h4>Step 3: Configure Folder Permissions</h4><p>Domain computers need read access to this folder at logon time before any user credential is available so you must grant permissions to Authenticated Users and Domain Users.</p><p>1 Right-click the wallpaper folder → Properties → Security tab.</p><p>2 Confirm these groups exist: Authenticated Users and Domain Users.</p><p>3 Grant the following permissions: Read, Read &amp; Execute, List Folder Contents.</p><h4>Step 4: Create the Centralized Logging Folder</h4><p>This is what separates a production deployment from a quick fix. A shared log folder on the DC lets you confirm which machines applied the wallpaper, catch failures, and audit by date all from one location.</p><p>1 On the Domain Controller, create the folder: C:\WallpaperLogs</p><p>2 Right-click → Properties → Sharing → Advanced Sharing.</p><p>3 Enable “Share this folder”. Set share name as WallpaperLogs$ (the $ makes it a hidden share good practice).</p><p>4 Set permissions: Domain Users → Change/Write and Administrators → Full Control.</p><p>Final share path: \\your-domain.com\WallpaperLogs$</p><h4>Step 5: Create the PowerShell Script</h4><p>The script does several things intelligently: it copies the wallpaper locally (so VPN users get it fast on next login), validates the copy, sets the registry key to apply it, and logs everything.</p><blockquote><strong>Key Design Decision </strong>The script uses file hash comparison if the wallpaper already on the client machine matches the one in SYSVOL, it skips the copy entirely. This reduces logon overhead significantly, especially for VPN users.</blockquote><p>1 Open Notepad as Administrator.</p><p>2 Copy and Paste in the PowerShell wallpaper deployment script below</p><pre># ==============================<br># Wallpaper Deployment<br># ==============================<br><br>$LocalFolder = &quot;C:\CompanyWallpaper&quot;<br>$LocalWallpaper = &quot;C:\CompanyWallpaper\your-image.jpg&quot;<br>$LocalLogFile = &quot;C:\CompanyWallpaper\wallpaper-log.txt&quot;<br><br>$SourceWallpaper = &quot;\\your-domain.com\SYSVOL\your-domain.com\scripts\wallpaper\your-image.jpg&quot;<br><br># Central server log location<br>$CentralLogFolder = &quot;\\your-domain.com\WallpaperLogs$&quot;<br>$ComputerName = $env:COMPUTERNAME<br>$UserName = $env:USERNAME<br>$CentralLogFile = &quot;$CentralLogFolder\$ComputerName-$UserName-wallpaper-log.txt&quot;<br><br># Create local folder<br>if (!(Test-Path $LocalFolder)) {<br>    New-Item -ItemType Directory -Path $LocalFolder -Force<br>}<br><br>function Write-Log {<br>    param ([string]$Message)<br><br>    $TimeStamp = Get-Date -Format &quot;yyyy-MM-dd HH:mm:ss&quot;<br>    $LogEntry = &quot;$TimeStamp | Computer: $ComputerName | User: $UserName | $Message&quot;<br><br>    Add-Content -Path $LocalLogFile -Value $LogEntry<br><br>    if (Test-Path $CentralLogFolder) {<br>        Add-Content -Path $CentralLogFile -Value $LogEntry<br>    }<br>}<br><br>Write-Log &quot;Script started.&quot;<br><br># Check source wallpaper<br>if (!(Test-Path $SourceWallpaper)) {<br>    Write-Log &quot;ERROR: Cannot access source wallpaper: $SourceWallpaper&quot;<br>    exit<br>}<br><br>Write-Log &quot;Source wallpaper found.&quot;<br><br># Check if local wallpaper already exists and is same as source<br>if (Test-Path $LocalWallpaper) {<br>    try {<br>        $SourceHash = (Get-FileHash $SourceWallpaper).Hash<br>        $LocalHash = (Get-FileHash $LocalWallpaper).Hash<br><br>        if ($SourceHash -eq $LocalHash) {<br>            Write-Log &quot;Wallpaper already up to date. No copy needed.&quot;<br><br>            $CurrentWallpaper = (Get-ItemProperty -Path &#39;HKCU:\Control Panel\Desktop&#39; -Name Wallpaper).Wallpaper<br><br>            if ($CurrentWallpaper -eq $LocalWallpaper) {<br>                Write-Log &quot;Desktop wallpaper already correctly applied. No action needed.&quot;<br>                Write-Log &quot;Script completed successfully.&quot;<br>                exit<br>            } else {<br>                Write-Log &quot;Wallpaper file is current, but desktop registry needs update.&quot;<br>            }<br>        } else {<br>            Write-Log &quot;New wallpaper detected. Update required.&quot;<br>        }<br>    }<br>    catch {<br>        Write-Log &quot;ERROR: Failed during hash comparison. Details: $($_.Exception.Message)&quot;<br>    }<br>} else {<br>    Write-Log &quot;Local wallpaper not found. Copy required.&quot;<br>}<br><br># Copy wallpaper locally<br>try {<br>    Copy-Item $SourceWallpaper $LocalWallpaper -Force -ErrorAction Stop<br><br>    if (Test-Path $LocalWallpaper) {<br>        Write-Log &quot;Wallpaper copied locally successfully.&quot;<br>    } else {<br>        Write-Log &quot;ERROR: Copy command ran, but local wallpaper file was not found.&quot;<br>        exit<br>    }<br>}<br>catch {<br>    Write-Log &quot;ERROR: Failed to copy wallpaper. Details: $($_.Exception.Message)&quot;<br>    exit<br>}<br><br># Update registry<br>try {<br>    Set-ItemProperty -Path &#39;HKCU:\Control Panel\Desktop&#39; -Name Wallpaper -Value $LocalWallpaper -ErrorAction Stop<br>    Write-Log &quot;Registry updated successfully.&quot;<br>}<br>catch {<br>    Write-Log &quot;ERROR: Failed to update registry. Details: $($_.Exception.Message)&quot;<br>    exit<br>}<br><br># Refresh wallpaper<br>try {<br>    RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters<br>    Write-Log &quot;Wallpaper refresh triggered.&quot;<br>}<br>catch {<br>    Write-Log &quot;ERROR: Failed to refresh wallpaper. Details: $($_.Exception.Message)&quot;<br>    exit<br>}<br><br>Write-Log &quot;Script completed successfully.&quot;</pre><p>3 Save as Set-Wallpaper.ps1 to the SYSVOL scripts folder:</p><p>\\your-domain.com\SYSVOL\your-domain.com\scripts\Set-Wallpaper.ps1</p><h4>Step 6: Create the BAT Launcher (Critical Fix)</h4><p>This step is something many guides skip and it’s exactly why direct .ps1 GPO logon scripts often silently fail in hybrid environments. The fix: wrap the PowerShell call inside a BAT file.</p><blockquote><strong>⚠️ Why a BAT file? </strong>GPO logon scripts run in a restricted security context. Direct .ps1 execution through GPO failed consistently in our hybrid environment. A BAT launcher resolves this completely by invoking PowerShell explicitly with the correct flags.</blockquote><p>1 Open Notepad and paste this content:</p><pre>powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File &quot;\\your-domain.com\SYSVOL\your-domain.com\scripts\Set-Wallpaper.ps1&quot;</pre><p>2 Click File → Save As. Change “Save as type” to All Files (*.*).</p><p>3 Save as Run-Wallpaper.bat inside the SYSVOL scripts folder.</p><p>\\your-domain.com\SYSVOL\your-domain.com\scripts\Run-Wallpaper.bat</p><h4>Step 7: Create and Configure the GPO</h4><p>1 Press Win + R → type gpmc.msc to open Group Policy Management Console.</p><p>2 Navigate to: Forest → Domains → your-domain.com → Group Policy Objects.</p><p>3 Right-click Group Policy Objects → New. Name it: Wallpaper Logon Script Policy.</p><h4>Configure the Logon Script</h4><p>1 Right-click the GPO → Edit.</p><p>2 Navigate to: User Configuration → Policies → Windows Settings → Scripts (Logon/Logoff)</p><p>3 Click Add → Browse and select Run-Wallpaper.bat → Click Apply and OK.</p><h4>Configure PowerShell Execution Policy</h4><p>1 In the same GPO editor, navigate to: Computer Configuration → Policies → Administrative Templates → Windows Components → Windows PowerShell</p><p>2 Open “Turn on Script Execution” → Set to Enabled → Choose “Allow all scripts”.</p><h4>Step 8: Link the GPO to Your OU</h4><p>1 In GPMC, locate the OU containing your users and computers.</p><p>2 Right-click the OU → Link an Existing GPO → Select Wallpaper Logon Script Policy.</p><h4>Step 9: Test the Deployment</h4><p>1 On a client PC, open Command Prompt as Administrator.</p><p>2 Run: gpupdate /force</p><p>3 Log off completely, then log back in.</p><blockquote><strong>Expected Results </strong>Wallpaper applies automatically at login · No PowerShell prompt appears · Wallpaper is copied to C:\CompanyAssets\company-wallpaper.jpg · Logs are generated at C:\CompanyAssets\wallpaper-log.txt and centrally at \\your-domain.com\WallpaperLogs$</blockquote><h4>Troubleshooting: Common Issues &amp; Fixes</h4><p><strong><em>Access denied</em> to wallpaper path:</strong> Grant Read/Read &amp; Execute to <em>Authenticated Users</em> on the wallpaper folder.</p><p><strong>Script runs manually but not via GPO:</strong> Use the BAT launcher instead of direct .ps1 execution.</p><p><strong>Wallpaper not refreshing after update: </strong>Add a RUNDLL32 refresh command at the end of the script</p><p><strong>False-positive entries in logs:</strong> Add file validation <em>after</em> the copy to confirm successful write</p><p><strong>Inconsistent results for VPN/hybrid users: </strong>Copy wallpaper locally first, <em>then</em> apply avoids dependency on live VPN connection</p><h3>Final Outcome</h3><p>After completing all steps, this is what the deployment achieves end-to-end:</p><p>⚡PowerShell Automation</p><p>🚀BAT Launcher for GPO Compatibility</p><p>📡SYSVOL Distribution</p><p>📋Centralized Logging</p><p>🔁Hash-Based Optimization</p><p>🌐Hybrid / VPN Compatibility</p><p><strong>Summary </strong>The wallpaper is cached locally on each client machine on first login, so subsequent logins even over slow VPN are fast. Only when the file actually changes (detected via hash) does the script perform a new copy. This makes the deployment efficient, auditable, and resilient in hybrid environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b02468beb95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hardening Your Hybrid Identity: Kerberos Key Rotation for Seamless SSO]]></title>
            <link>https://medium.com/@ikeaustine/hardening-your-hybrid-identity-kerberos-key-rotation-for-seamless-sso-dd4c49ca2e77?source=rss-ce1b95aaae2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd4c49ca2e77</guid>
            <dc:creator><![CDATA[IKEAZOTA AUGUSTINE]]></dc:creator>
            <pubDate>Thu, 22 May 2025 11:33:49 GMT</pubDate>
            <atom:updated>2025-06-27T18:56:47.555Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6IMjg0wgFxQRdDbeAWJ7EA.png" /></figure><h3>Introduction</h3><p>Successfully deploying a secure hybrid identity environment requires regular maintainance practices, one of it is the Kerberos Decryption key rotations, especially when using <strong>Azure AD Seamless Single Sign-On (SSO)</strong>. One critical task for domain administrators is rolling over the <strong>Kerberos decryption key</strong> for the <strong>AZUREADSSO computer account</strong> , a process Microsoft recommends performing every 30 days.</p><p>This article walks you through the <strong>manual step-by-step process</strong> for safely rolling over the key in your <strong>on-premises Active Directory environment</strong>.</p><h3>Why Roll Over the Kerberos Key?</h3><p>The Kerberos decryption key is used to encrypt and decrypt tickets for authentication. If the same key is used for an extended period, it becomes a potential attack surface. Key rollover:</p><ul><li>Improves security posture.</li><li>Prevents cryptographic vulnerabilities.</li><li>Follows Microsoft’s recommended best practices.</li></ul><blockquote><strong>Important:</strong> Do not perform a rollover more than once per forest within a single Kerberos ticket lifetime (default is 10 hours). Doing so could cause temporary authentication failures.</blockquote><h3>Prerequisites</h3><p>Before starting, ensure you meet the following requirements:</p><ul><li><strong>Domain Administrator credentials</strong> (must <em>not</em> belong to the Protected Users group).</li><li><strong>Hybrid Identity Administrator</strong> privileges in Azure AD.</li><li><strong>Azure AD Connect</strong> must be installed on the server you’re using.(In my case my AD Connect server runs seperately from my AD DC server.)</li><li><strong>PowerShell (Run as Administrator)</strong>.</li></ul><h3>Step-by-Step Manual Rollover Guide</h3><h3>Step 1: Load AzureADSSO PowerShell Module</h3><p>Open PowerShell as Administrator and navigate to the Azure AD Connect installation directory:</p><pre>cd &quot;$env:ProgramFiles\Microsoft Azure Active Directory Connect&quot;<br>Import-Module .\AzureADSSO.psd1</pre><h3>Step 2: Authenticate with Azure AD</h3><p>To initiate the context with Azure AD, run:</p><pre>New-AzureADSSOAuthenticationContext</pre><p>A sign-in window will appear. Use your <strong>Hybrid Identity Admin</strong> credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Mv-M0HlKyQ04zqkVbkjPA.png" /><figcaption>signin</figcaption></figure><h3>Step 3: List Forests with Seamless SSO Enabled</h3><p>Check which forests currently have Seamless SSO enabled. This confirms Seamless SSO is active on your forest:</p><pre>Get-AzureADSSOStatus | ConvertFrom-Json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VIfG_4wVRMixc3vubETiLg.png" /></figure><h3>Step 4: Collect Domain Admin Credentials</h3><p>Store your <strong>Domain Admin credentials</strong> in a PowerShell variable:</p><pre>$creds = Get-Credential</pre><p>A prompt will ask for username and password. Enter in the format: yourdomain\username and password</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0vGxd6XYUchriA6Uncxhxg.png" /></figure><h3>Step 5: Execute the Key Rollover</h3><p>With your credentials stored, now perform the key update:</p><pre>Update-AzureADSSOForest -OnPremCredentials $creds</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvcTM6sm_CFn3OIXvQibqA.png" /></figure><p>If successful, you should see informational logs confirming the <strong>AZUREADSSOACC</strong> account was updated.</p><blockquote>NB<strong>:</strong> Ensure the AZUREADSSOACC account has appropriate permissions. If you receive an “Access is denied” error, check that your domain admin account has full control over the computer object in Active Directory.</blockquote><h4>Conclusion</h4><p>Rotating the <strong>Kerberos decryption key</strong> is a critical but often overlooked security task for environments using <strong>Azure AD Seamless SSO</strong>. By following this guide regularly, ideally every 30 days, you can:</p><ul><li>Keep your hybrid identity secure.</li><li>Prevent authentication errors.</li><li>Align with Microsoft’s identity protection standards.</li></ul><p>In my next article, we will take it a step further by automating this process using Python and PowerShell. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd4c49ca2e77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Join local systems to self-hosted cloud AD through AWS VPN Client]]></title>
            <link>https://medium.com/@ikeaustine/join-local-systems-to-self-hosted-cloud-ad-through-aws-vpn-client-a98ce947136b?source=rss-ce1b95aaae2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a98ce947136b</guid>
            <dc:creator><![CDATA[IKEAZOTA AUGUSTINE]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 07:10:17 GMT</pubDate>
            <atom:updated>2025-06-27T18:50:30.547Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Joining Local Systems to Active Directory Using AWS Client VPN</strong></h3><h4><strong>Introduction</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ScIZpsERUt0bJ0e7RyCL-A.png" /></figure><p>In my last article, I walked you through the process of setting up an Active Directory (AD) domain on AWS, which was relatively straightforward. However, joining local systems to the domain over the internet proved to be the real challenge. What seemed like a simple task quickly turned into a frustrating experience filled with connectivity issues, authentication errors, and moments of self-doubt in my troubleshooting skills.</p><p>At first, I attempted to connect the system without using a VPN by exposing all necessary ports on my AD server to the internet. This was done strictly in a test environment, as exposing an AD server to the public internet is not a security best practice. After configuring the system with the required settings, I was able to ping my AD server’s IP, which seemed like a good sign. Unfortunately, I still couldn’t join the system to the domain. For some reason, the handshake between the server and the system never established successfully. At this point, even the devil can not establish this connection for you. But if anyone has managed to achieve this securely, I’d love to know how!</p><p>This initial setup was simply an experiment to determine whether I could bypass using a VPN. However, I quickly realized that achieving this without exposing my server to the public internet was impossible.</p><p>To play it safe, I opted for the recommended approach of setting up a VPN to establish a secure tunnel between my device and the cloud. I spent over a week trying to join my system to the AD domain, and what should have been a smooth process turned into a struggle due to a single misconfiguration in my VPN setup. It turned out to be a crucial setting that impacted the entire configuration.</p><p>In this article, I’ll walk you through the steps I took to successfully join our local systems to the AD domain using AWS Client VPN. I’ll also highlight the challenges I encountered, the mistakes I made, and the solutions that finally worked. If you’re looking to extend your AD domain to remote users or branch offices with no direct network access to the domain controller, this guide will help you navigate the process effectively.</p><h3><strong>Step 1: Setting Up AWS Client VPN</strong></h3><ol><li><strong>configure an AWS Client VPN Endpoint</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0bWilko3aUjPVPCzknN3oA.png" /></figure><ul><li>On your <strong>VPC dashboard</strong>, navigate to the <strong>Client VPN</strong> menu on the side pane.</li><li>Select <strong>Client VPN endpoint</strong> and click <strong>Create Client VPN Endpoint</strong>.</li><li>Enter the VPN name. Under <strong>Client IPv4 CIDR</strong>, enter an IP address range (this is the IP address pool your users will be dynamically assigned when connected to the VPN).</li><li>On the <strong>Authentication information</strong> tab, select your <strong>server certificate</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ekpLhQglPkc4i3EWhfoSCw.png" /></figure><blockquote><strong>NOTE:</strong> The certificate can be generated on AWS Certificate Manager. However, since we are configuring a Client VPN endpoint that requires both a <strong>client and server certificate</strong> for mutual authentication, we will generate our own certificate and key, then import them into <strong>AWS ACM</strong>. Since this guide focuses on setting up AWS VPN, I won’t cover the process of generating your client-server certificate and key here. However, you can click the link below to watch a tutorial:</blockquote><blockquote><a href="https://drive.google.com/file/d/1Nl2LpeIuxwiRwTa2wLC638E8gw7ubr9T/view?usp=sharing">generating client-server-RSA-cert.mp4</a></blockquote><blockquote><a href="https://github.com/OpenVPN/easy-rsa/releases">OpenVPN easy-rsa utility</a></blockquote><ul><li>Select <strong>Use Mutual Authentication</strong> &gt; Select your <strong>client certificate</strong>.</li><li><strong>Connection logging and client connect handler</strong> can be left on default.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jj7d8CNXKoal_mJqX9vjxA.png" /></figure><blockquote><strong>Critical Setting: DNS Server IP</strong></blockquote><blockquote>The <strong>DNS Server IP</strong> setting, which AWS marks as “optional,” happens to be the <strong>backbone of our configuration</strong>. Initially, I left this option on default, and that single action prevented my system from joining the domain even after getting all other settings right. This made me realize that not all AWS settings marked <strong>OPTIONAL</strong> are actually optional!</blockquote><blockquote><em>(This mistake had me troubleshooting my setup for a week. What really confused me was that I could join an EC2 workstation on the same IP range as my AD server to the domain, proving that my domain configurations were correct. However, despite a successful Client VPN connection and my system being on the same IP range as the AD server, I still couldn’t join the domain.)</em></blockquote><blockquote><strong>Fix:</strong> Enter your <strong>AD server’s private IP address</strong> in <strong>DNS Server 1</strong> and any public DNS Server IP “8.8.8.8&quot; in <strong>DNS Server 2</strong> (or leave it blank).</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pgDkgK_RPDtsLTRxNyazLw.png" /></figure><p><strong>Other Essential Settings</strong></p><ul><li><strong>Enable split-tunnel: </strong>Disabled by default. Enable this to allow internet traffic to flow to other sites while browsing, even when connected to the Client VPN.</li><li><strong>Enable client banner text</strong>: Select this option and enter your preferred text, which will be displayed upon successfully establishing the VPN connection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x_3z57mQ4lX1cwUnnuG5UA.png" /></figure><ul><li>You can keep the rest of the default settings, and choose <strong>Create Client VPN endpoint.</strong></li></ul><h3><strong>Step 2: Associating a target network</strong></h3><p>After creating the Client VPN endpoint, its state is <strong>pending-associate</strong>. Clients can only establish a VPN connection after associating at least one target network.</p><ul><li>Select the <strong>Client VPN endpoint</strong> created in the previous step &gt; Choose <strong>Target Network Associations</strong> &gt; Click <strong>Associate Target Network</strong> &gt; Select the <strong>VPC</strong> where the subnet is located &gt; Choose the <strong>subnet</strong> to associate with the <strong>Client VPN endpoint</strong> &gt; Click <strong>Associate Target Network</strong> to complete the process.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dXwO-69x9yMcoHiBg660Sg.png" /></figure><p>When you associate the first subnet with the Client VPN endpoint, the following happens:</p><ul><li>The <strong>state of the Client VPN endpoint</strong> changes to <strong>available</strong>, allowing clients to establish a VPN connection. However, they <strong>cannot access VPC resources</strong> until <strong>authorization rules</strong> are added.</li><li>The <strong>local route of the VPC</strong> is automatically added to the Client VPN endpoint route table.</li><li>The <strong>VPC’s default security group</strong> is automatically applied to the Client VPN endpoint.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KaV_rv3nXRihJLuhb4iA7A.png" /></figure><h3><strong>Step 3: Add an authorization rule for the VPC</strong></h3><p>For clients to access the VPC, there needs to be a route to the VPC in the Client VPN endpoint’s route table and an authorization rule. The route was already added automatically in the previous step. For this tutorial, we want to grant all users access to the VPC.</p><ul><li>Select the <strong>Client VPN endpoint</strong> &gt; Choose <strong>Authorization Rules</strong> &gt; Click <strong>Add Authorization Rule</strong>.</li><li>Enter the <strong>CIDR</strong> of the network to enable access (e.g., specify the <strong>IPv4 CIDR block of the VPC</strong> to allow full access).</li><li>Under <strong>Grant Access To</strong>, choose <strong>Allow access to all users</strong>.</li><li>(Optional) Add a <strong>description</strong>. &gt; Click <strong>Add Authorization Rule</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBtZ3-UVr9ukio1G2fgfRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VfZBn70D_k9d4spv" /></figure><blockquote><strong>NOTE:</strong> Since no security groups were specified during Client VPN endpoint creation, That means that the default security group for the VPC is automatically applied to the Client VPN endpoint when a target network is associated. To ensure proper connectivity, verify that this security group allows outbound traffic to the internet by adding a rule for all traffic to 0.0.0.0/0. Also, check that the security groups for your VPC resources (where your AD server is hosted) allows access from the default VPC security group to enable client connections.</blockquote><blockquote>However, you can create the Client vpn endpoint in the same VPC with your resources. This will save you the stress of resetting your security group rules.</blockquote><h3><strong>Step 4: Setting up AWS Client VPN app on the system</strong></h3><ul><li>Select the Client VPN endpoint that you created for this tutorial, and choose Download client configuration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hh_d9sRr3aSPoHxc" /></figure><ul><li>Open the <strong>Client VPN endpoint configuration file </strong>you just downloaded using your preferred text editor.<strong> Add &lt;cert&gt;&lt;/cert&gt; and &lt;key&gt;&lt;/key&gt; t</strong>ags to the file. Place the contents of the client certificate and the contents of the private key between the corresponding tags, as such:</li></ul><pre>&lt;cert&gt;<br>Contents of client certificate (.crt) file<br>&lt;/cert&gt;<br><br>&lt;key&gt;<br>Contents of private key (.key) file<br>&lt;/key&gt;</pre><ul><li>Save and close the Client VPN endpoint configuration file.</li><li>You can connect to the Client VPN endpoint using the AWS provided client app or another OpenVPN-based client application (in our case we will be connecting with an AWS VPN client app downloaded from the AWS website).</li><li>Install the app on the system you want to join to the domain. Open the app<strong> &gt; click on file &gt; </strong>select <strong>Manage Profile &gt; </strong>select <strong>Add Profile</strong> &gt; Enter your preferred Display Name &gt; click on the folder icon close to “<strong>VPN Configuration File</strong>” &gt; locate your Client VPN endpoint configuration file, select and click <strong>Add Profile</strong>.</li></ul><blockquote><strong>IMPORTANT: </strong>The AWS Client app must be installed on the local admin account.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAsUKz1OYewOE_gPngrgOg.png" /></figure><ul><li>Click “<strong>Connect”</strong> to connect to your vpn endpoint. Upon successful connection the message we configured on the <strong>Client Login Banner text</strong> will be displayed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jC-gKOpb8WNOFNIUb_7LaQ.png" /></figure><h3>Step 5: Joining system to the AD domain</h3><p>Once your VPN connection is estabished successfully.</p><ul><li>On system settings &gt; select <strong>system</strong> &gt; click <strong>about </strong>&gt; then click on <strong>Domain or workgroup</strong> &gt; click <strong>Change</strong> &gt; under <strong>“Member of “ </strong>select <strong>Domain </strong>&gt; enter the <strong>AD admin username and password</strong>. (your ec2 login details generate on AWS after creating the Server instance).</li><li>Upon successful authentication, A <strong>welcome to your domain</strong> banner is displayed. click <strong>OK, </strong>the system prompts you for a restart. click on <strong>Restart.</strong></li><li>Your system is now successfully joined to your AD domain.</li></ul><blockquote>Since the DNS server is already configured in the VPN endpoint settings, there’s no need to set up the DNS server on your local system. The connection will work seamlessly without any additional configuration.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wu0DowrgOOI172nfXvsfyw.png" /></figure><h4><strong>CHALLENGES &amp; MITIGATION</strong></h4><p><strong>Challenge:</strong> Users might experience constant inability to <strong>login </strong>to their account profile<strong> </strong>or <strong>communicate</strong> with your <strong>AD SERVER </strong>for Group policy updates, This is because AWS client VPN endpoint application installed on local admin account disconnects at system <strong>RESTART, SHUTDOWN</strong> or after <strong>TIMEOUT</strong> (which on default is set to 24hrs).</p><blockquote><strong>temporary solution: </strong>Anydesk Remote Desktop software can be configured on the user’s system to grant unattended access with a password authentication. This will enable Admin to login remotely to the local admin account to reconnect the client vpn endpoint before initiating domain login. (Anydesk should be configured to start on system startup).</blockquote><blockquote><strong>Final Solution</strong>: <strong>OpenvpnConnect</strong> software supports automatic connect after system reboot. Download <strong>OpenVPN software</strong> and configure app to launch automatically after device reboot, select the option <strong>Restore connection. </strong>This can be done on the app settings. You can use your existing aws vpn endpoint configuration file to setup this vpn. (You can now decide which software you prefer to use for your connection).</blockquote><p><strong>REMINDER: </strong>Update your AD server security group inbound rule to accept all traffic from your <strong>VPC, VPN CDIR </strong>and <strong>RDP</strong> from your <strong>IP.</strong> This keeps your AD Server well secured.</p><h3>Conclusion</h3><p>We have successfully joined our local system to our <strong>self-hosted cloud AD domain</strong>. This process ensures that we can <strong>securely connect to AD over the internet</strong> without the risk of exposing our AD server to the public internet.</p><p>In my <strong>next article</strong>, I will demonstrate how I was able to <strong>seamlessly migrate existing user data</strong> to their new AD profile after joining their systems to the domain using <strong>Azure AD-Connect and Single Sign-On (SSO).</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a98ce947136b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configuring a Self-Managed Active Directory Domain Controller (AD-DC) on AWS: A Cost-Effective…]]></title>
            <link>https://medium.com/@ikeaustine/configuring-a-self-managed-active-directory-domain-controller-ad-dc-on-aws-a-cost-effective-3027fc0475eb?source=rss-ce1b95aaae2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3027fc0475eb</guid>
            <dc:creator><![CDATA[IKEAZOTA AUGUSTINE]]></dc:creator>
            <pubDate>Fri, 07 Mar 2025 07:02:28 GMT</pubDate>
            <atom:updated>2025-06-27T19:01:57.663Z</atom:updated>
            <content:encoded><![CDATA[<h3>Configuring a Self-Managed Active Directory Domain Controller (AD-DC) on AWS: A Cost-Effective Approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4OOab91w8PeYgHbGMuEGjw.png" /></figure><h3>Introduction</h3><p>It was a challenging two weeks as I tackled my first real hands-on task on AWS after recently earning my AWS certifications. I knew it wouldn’t be as easy as watching YouTube tutorial videos, but I was determined to get my hands dirty as a cloud engineer, lol...</p><p>My company aimed to become ISO-compliant, striving to meet industry best practices and adhere to strict security regulations. To efficiently manage users and devices, I was assigned the crucial task of ensuring that our IT infrastructure met all compliance requirements for certification.</p><p>In this article, I’ll take you through a step-by-step guide on how you can successfully configure a custom Active Directory Domain Controller (AD-DC) on AWS.</p><blockquote><strong>This approach not only streamlined user and device management but also saved my company 55% in implementation costs compared to Microsoft Intune or AWS managed AD which should have been our initial go-to solutions, given that most of our company’s services are cloud-based.</strong></blockquote><h3><strong>Step 1: Setting Up the AWS Environment</strong></h3><h4>1.1 Provisioning an ec2 instance</h4><ul><li>Provision an ec2 instance using the below windows server configurations.</li></ul><pre>server Model: Window server 2022 base<br>server type: t3-large</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmfhPQa4E2YT6EC2KPemZA.png" /></figure><ul><li>Create and download a key pair which will be used to login into the instance.</li><li>I used an existing vpc and public subnet with an internet gateway already attached to the vpc. however, you can create a new VPC or use AWS default vpc while creating a new subnet using the steps outlined below.</li></ul><blockquote>In the <strong>Network Settings</strong>, click <strong>edit &gt;</strong> select the <strong>default vpc &gt; </strong>Click Create <strong>New Subnet &gt;</strong> Choose the VPC you just created <strong>&gt; </strong>Enter a Subnet Name <strong>&gt;</strong> Select an <strong>Availability Zone &gt; </strong>Specify an <strong>IPv4 CIDR block </strong>within the <strong>VPC range</strong> (e.g., 10.0.1.0/24)<strong> &gt; Click Create Subnet</strong></blockquote><ul><li>Create a new security group using the below rules.</li></ul><pre>Security group tag: win-SG<br>- Allow RDP (TCP 3389) from your my IP.<br>- Allow DNS (UDP 53, TCP 53) for domain name resolution.<br>- Allow LDAP (TCP 389) for directory services.</pre><ul><li>select auto-assign elastic IP or you can assign an elastic IP to your instance after you have created the instance. In my case, I assigned my instance an Elastic IP (This ensures static public access for management purposes)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C9TpEW1XcK62ST1_bRCRVA.png" /></figure><p>Every other settings can be left on default, while you launch the instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uQO_CqcQIFFB4apLVDdknQ.png" /></figure><h4>1.2 Connecting to the Windows Server Instance</h4><p>Once the instance <strong>has passed the checks </strong>and state set to <strong>running</strong>, select it and click “Connect”.</p><ol><li>Select RDP client, next click “<strong>Get password”</strong> &amp; upload the key pair which we downloaded during the instance configuration setup, this will generate a password, needed to connect to the instance.</li><li>Download the RDP file and use the password generated to connect to the instance.</li><li>Go through the steps to connect, entering your password and click connect.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQebLjkA3ihGer00NWx5XA.png" /></figure><h3><strong>Step 2: Installing &amp; Configuring Active Directory Domain Services (AD-DS)</strong></h3><h4><strong>1.1 Setting up Domain Controller</strong></h4><p>After connecting to the instance through the RDP</p><ol><li>First, I renamed the computer to “QDDC”. (you can use your prefered name)</li></ol><blockquote>Click <strong>Start</strong> &amp; go to <strong>Server Manager</strong>. Click <strong>Local Server &gt; Computer Name &gt; Change… &gt; </strong>Change <strong>Computer name</strong> to ‘<strong>QDDC’</strong>. Click <strong>OK</strong>. (This isn’t mandatory, but a good practice when in production. Restart the instance once completed and reconnect using the downloaded RDP file and password).</blockquote><p>2. I configured the AD-DC Instance with a static IP address given by AWS at creation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIH-VxBTSLl-TI4eUchHCg.png" /></figure><blockquote><strong>Set the static IP address in the network settings: </strong>Open the <strong>Control Panel</strong>, Click on <strong>Network and Internet &gt;</strong> <strong>Network and Sharing Center &gt; Ethenet 2 &gt; Properties &gt; Internet Protocol Version 4 (TCP/IPv4) &gt; Properties</strong> then Click the bubble <strong>Use the following IP Address </strong>&amp; fill in the information we got from our command prompt earlier. Click <strong>OK</strong>.</blockquote><blockquote><em>For the DNS Server I used my static IP and Googles DNS server 8.8.8.8</em></blockquote><h4>1.2 Installing Active Directory services</h4><p>Open <strong>Server Manager</strong> &gt;<strong>Manage</strong> &gt;<strong>Add Roles and Features</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGTrNLYdMTw96EQFBacoKw.png" /></figure><p>2. Choose <strong>Role-Based Installation</strong>.</p><p>3. Select <strong>Active Directory Domain Services (AD-DS)</strong> and install the required features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5J3COm8CG5B1ul_8mEMS9Q.png" /></figure><p>4. Begin going through the Wizard &amp; add “Active Directory Domain Services” and “DNS Server”.</p><p>5. Follow the prompts to install these roles. This will take a moment.</p><p>6. After installation, click on the warning flag in <strong>Server Manager</strong> and select <strong>Promote this server to a domain controller</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*8VqJdTjVLYnl9h4S.png" /></figure><p>7. I selected <strong>Add a new forest</strong> &amp; <strong>Specify the root domain</strong> as “domain.com”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JoO_5c4QWpDztGN5Y41n5g.png" /></figure><p>Also set the DSRM password, in case you need to recover the domain. For this exercise you can hit “N<strong>ext &gt;”</strong> for each configuration it makes you go through.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1y72zGyMEbPHKcn2l_Ykhg.png" /></figure><p>7. Complete the wizard and restart the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d2UqCoz2OsniqGfEdl0kTg.png" /></figure><blockquote>Note: You can configure reserve lookup zone for <strong>IP resolution</strong> to <strong>hostname. </strong>This is <strong>optional </strong>but recommended as it is used for <strong>network trobleshooting.</strong></blockquote><h4>Step 3. Automating User and Group Creation in Active Directory with PowerShell”.</h4><p>Now that our Active Directory is set up, it’s time to populate it with objects — Organizational Units (OUs), users, groups, and computers. Instead of manually creating each OU and user, which is both exhausting and time-consuming, I leveraged ChatGPT to generate a PowerShell script for bulk user creation.</p><p>This was my <strong>favorite part</strong> of the setup because I got to put my <strong>Python programming </strong>skills to the test! I carefully reviewed the script, modified it to fit my company’s requirements, and thoroughly tested it before deployment to avoid bugs. This approach not only made the process efficient but also ensured accuracy while onboarding all 32 company users into the AD.</p><ol><li>click on the window icon, select windows PowerShell.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*79j52X_Qlz0q5OIItmbtNg.png" /></figure><p>2. enter the below script to create your OU’s which includes “users”, “groups”, and “computers” accordingly.</p><pre># Import Active Directory module<br>Import-Module ActiveDirectory<br><br># Define the parent Organizational Unit (OU)<br>$ParentOU = &quot;OU=HQ-LAG,DC=yourdomain,DC=com&quot;<br><br># Create additional OUs under QS-HQ-LAG<br>$OUsToCreate = @(&quot;Users&quot;, &quot;Groups&quot;, &quot;Computers&quot;)<br><br>foreach ($OUName in $OUsToCreate) {<br>    $OUPath = &quot;OU=$OUName,$ParentOU&quot;<br>    if (-not (Get-ADOrganizationalUnit -Filter {Name -eq $OUName})) {<br>        New-ADOrganizationalUnit -Name $OUName -Path $ParentOU -ProtectedFromAccidentalDeletion $false<br>        Write-Host &quot;Created OU: $OUPath&quot;<br>    } else {<br>        Write-Host &quot;OU &#39;$OUPath&#39; already exists.&quot;<br>    }<br>}<br><br># Define the target Users OU<br>$OU = &quot;OU=Users,$ParentOU&quot;<br><br># Define an array of users<br>$Users = @(<br>    @{<br>        FirstName = &quot;john&quot;<br>        LastName  = &quot;deo&quot;<br>        Username  = &quot;john.deo&quot;<br>        Password  = &quot;Password@1&quot;<br>        Email     = &quot;john.deo@yourdomain.com&quot;<br>    },<br>    @{<br>        FirstName = &quot;mark&quot;<br>        LastName  = &quot;steve&quot;<br>        Username  = &quot;mark.steve&quot;<br>        Password  = &quot;Password@1&quot;<br>        Email     = &quot;mark.steve@yourdomain.com&quot;<br>    },<br>    @{<br>        FirstName = &quot;tammy&quot;<br>        LastName  = &quot;cole&quot;<br>        Username  = &quot;tammy.cole&quot;<br>        Password  = &quot;Password@1&quot;<br>        Email     = &quot;tammy.cole@yoourdomain.com&quot;<br>    }<br>)<br><br># Loop through each user in the array<br>foreach ($User in $Users) {<br>    # Extract user details<br>    $FirstName = $User[&quot;FirstName&quot;]<br>    $LastName  = $User[&quot;LastName&quot;]<br>    $Username  = $User[&quot;Username&quot;]<br>    $Password  = ConvertTo-SecureString $User[&quot;Password&quot;] -AsPlainText -Force<br>    $Email     = $User[&quot;Email&quot;]<br>    $DisplayName = &quot;$FirstName $LastName&quot;<br>    $UPN = &quot;$Username@yourdomain.com&quot;<br><br>    # Create the AD user and capture the result<br>    try {<br>        $NewUser = New-ADUser -Name $DisplayName `<br>                              -GivenName $FirstName `<br>                              -Surname $LastName `<br>                              -SamAccountName $Username `<br>                              -UserPrincipalName $UPN `<br>                              -EmailAddress $Email `<br>                              -AccountPassword $Password `<br>                              -Path $OU `<br>                              -Enabled $true `<br>                              -PassThru<br><br>        # Ensure user is created before enabling<br>        if ($NewUser) {<br>            # Force user to change password at first login <br>            Set-ADUser -Identity $Username -ChangePasswordAtLogon $true<br><br>            Enable-ADAccount -Identity $NewUser.SamAccountName<br>            Write-Host &quot;User &#39;$Username&#39; has been successfully created and enabled.&quot;<br>        } else {<br>            Write-Host &quot;Failed to create user &#39;$Username&#39;.&quot;<br>        }<br>    } catch {<br>        Write-Host &quot;Error creating user &#39;$Username&#39;: $_&quot;<br>    }<br>}</pre><blockquote><em>This script automates the creation of three Organizational Units (OUs): Users, Groups, and Computers inside OU=HQ-LAG.</em></blockquote><blockquote>Similarly, the script <strong>adds users to the Users OU</strong>, ensuring:<br> The OUs exist before creation.<br> Users are created successfully before enabling them.<br> Passwords are securely set.<br> Users are required to change their password at first login.<br> Errors are handled using a <strong>try…catch block</strong> to prevent failures.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bW5SWn2NH8DnJnHHIKZkoA.png" /></figure><h4>Conclusion</h4><p>This concludes the guide on setting up an Active Directory environment on AWS, including adding users, groups, and computers to the domain. To further enhance your setup, you can implement Group Policies to streamline user and computer management.</p><p>The AD configuration wasn’t the reason I spent two weeks on this project, but <strong>joining the systems to the domain</strong> was where I encountered challenges that made me second-guess my potential (hahaha). In my next article, I will walk you through how I successfully joined our local systems to the AD domain over the internet using AWS Client VPN.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3027fc0475eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Deploy a Static Website with AWS CloudFormation: A Quick Guide]]></title>
            <link>https://medium.com/@ikeaustine/how-to-deploy-a-static-website-with-aws-cloudformation-a-step-by-step-guide-b57af193ff69?source=rss-ce1b95aaae2d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b57af193ff69</guid>
            <dc:creator><![CDATA[IKEAZOTA AUGUSTINE]]></dc:creator>
            <pubDate>Tue, 17 Sep 2024 13:34:52 GMT</pubDate>
            <atom:updated>2024-09-30T07:04:05.753Z</atom:updated>
            <content:encoded><![CDATA[<p>Deploying cloud services can be daunting and tasking especailly with the traditional manual approach using the “AWS Management Console” which is very much error prone. While the user interface may seem user-friendly, the myriad of configuration options and default settings can have you thinking you’d left out some important configuration.</p><p>In this article, we’ll explore how to leverage AWS CloudFormation to simplify the deployment of a static website. By using Infrastructure as Code (IaC), CloudFormation enables you to define and manage your AWS resources through code, eliminating the complexities of manual configuration. This method not only ensures consistency and repeatability but also reduces the risk of human error, making your deployment process more efficient and reliable.</p><p>Join me as we’ll complete the entire deployment in just 6 steps, demonstrating how CloudFormation can make managing cloud resources both efficient and reliable.</p><h3>Steps to Deploy the CloudFormation Template from VSCode Bash Terminal</h3><p>First, ensure you have an <strong>IAM user</strong> with <strong>admin</strong> rights permissions. Download the credentials for this user to your system, as they will be used to configure the AWS CLI.</p><p><strong>STEP 1: Create a New Working Directory from your VSCode</strong></p><p>Create a new directory CafeWebsite_IAC folder to organize your CloudFormation template and website files. This helps keep your project structured.</p><p><strong>STEP 2: Prepare the CloudFormation Template</strong></p><p>Create a new file named s3-cafe-website.yaml, this will contain the CloudFormation template for your S3 bucket and website configuration. This file will be used to define and deploy your infrastructure as code (IAC). Copy and paste the following code into the file:</p><pre>AWSTemplateFormatVersion: &quot;2010-09-09&quot;<br>Description: &quot;Template to create and configure S3 bucket for static website hosting.&quot;<br><br>Resources:<br>  WebsiteConfiguration:<br>    Type: AWS::S3::Bucket<br>    Properties:<br>      BucketName: cafebucket-smarfy # Use a unique name identifier when naming your s3 bucket<br>      WebsiteConfiguration:<br>        IndexDocument: index.html<br>        ErrorDocument: error.html<br><br>Outputs:<br>  BucketName:<br>    Description: &quot;The S3 bucket name.&quot;<br>    Value: !Ref WebsiteConfiguration  # Outputs the bucket name<br>  WebsiteURL:<br>    Description: &quot;The URL of the static website hosted on the S3 bucket.&quot;<br>    Value: !Sub &quot;http://${WebsiteConfiguration}.s3-website-${AWS::Region}.amazonaws.com&quot;  # Constructs the website URL</pre><p><strong>STEP 3: Configure the AWS CLI</strong></p><ol><li>On your current working directory, open your bash terminal and run the command aws configure to set up the AWS CLI with the access key and secret key of the newly created IAM user with admin privileges. This step will ensure your CLI commands can interact with AWS services.</li><li>Run the aws cloudformation validate-template --template-body file://s3-cafe-website.yaml command to validate your cloudformation template and ensure your YAML template is correctly formatted and ready for deployment.</li><li>Use the command aws cloudformation create-stack --stack-name WebsiteBucket-stack --template-body file://s3-cafe-website.yaml to deploy the stack, passing in the YAML file. This will also create an S3 bucket and configure it for static website hosting.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S6jbnVUmc0pqrMJEvrS-cg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Ehg1t9pA2ETbzLTJC6NZg.png" /></figure><p><strong>STEP 4: Download the Website Files</strong></p><p>clone the source code to download the website file from GitHub repo using the command git clone https://github.com/smarfy01/cafe-static-website.git into your working directory.</p><p><strong>STEP 5: Upload Website Files to the S3 Bucket</strong></p><ol><li>First, we’ll set the public access block settings on the bucket to enable us copy the the files successfully to the s3 bucket. Run the command</li></ol><pre>aws s3api put-public-access-block --bucket cafebucket-smarfy --public-access-block-configuration &quot;BlockPublicAcls=false,RestrictPublicBuckets=false,IgnorePublicAcls=false,BlockPublicPolicy=false&quot;</pre><p>2. Run the command cd cafe-static-website/to change your working directory of the cloned source code folder.</p><p>3. Upload the website files to the S3 bucket and set their ACL policy to public-read. This configuration will make the files publicly accessible through a specified URL. Run the command:</p><pre>aws s3 cp --recursive . s3://cafebucket-smarfy/ --acl public-read</pre><p>If these operations are successful, you should see numerous <em>upload:&lt;file_name&gt;</em> messages in the command output just like the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q0KzPNR1xEdeYSROLUo3mg.png" /></figure><p><strong>STEP 6: Retrieve the website URL from the CloudFormation Output</strong></p><p>Remember that our CloudFormation template includes output parameters for BucketName and WebsiteURL. After successfully uploading the website files, run the following command to retrieve these outputs.</p><pre>aws cloudformation describe-stacks --stack-name WebsiteBucket-stack --query &quot;Stacks[0].Outputs&quot;</pre><p>This command will return an output similar to the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6CWPGdZnOk0k6ZHTf7-F4A.png" /></figure><p>You can use the WebsiteURL to access your static website hosted on S3 by entering it into your browser’s address bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X_vyYFn03XhMzy7W7R-oXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLVhcqUwEnKDdGWSb9uclA.png" /></figure><h3>Conclusion</h3><p>This guide walks through the entire process of deploying a static website with AWS CloudFormation from the VSCode bash terminal, including configuring the AWS CLI, deploying the CloudFormation stack, downloading and uploading website files, and retrieving the website URL from the CloudFormation output.</p><p>Feel free to modify and adapt this guide for your own use! Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b57af193ff69" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>