<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sudhin Suresh</title>
    <description>The latest articles on DEV Community by Sudhin Suresh (@sudhin_suresh).</description>
    <link>https://dev.to/sudhin_suresh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1922240%2F3c67de38-3efb-4ee3-b64e-38ff98c1831f.jpg</url>
      <title>DEV Community: Sudhin Suresh</title>
      <link>https://dev.to/sudhin_suresh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sudhin_suresh"/>
    <language>en</language>
    <item>
      <title>🚀 Fast Static Website Deployment with Pulumi, EC2, and GitHub Actions</title>
      <dc:creator>Sudhin Suresh</dc:creator>
      <pubDate>Sat, 05 Apr 2025 05:00:58 +0000</pubDate>
      <link>https://dev.to/sudhin_suresh/fast-static-website-deployment-with-pulumi-ec2-and-github-actions-1j4m</link>
      <guid>https://dev.to/sudhin_suresh/fast-static-website-deployment-with-pulumi-ec2-and-github-actions-1j4m</guid>
      <description>&lt;p&gt;💡 What I Built&lt;br&gt;
I created a fast, automated deployment pipeline for a static website using:&lt;/p&gt;

&lt;p&gt;AWS EC2 to host the site,&lt;/p&gt;

&lt;p&gt;Pulumi to provision infrastructure as code,&lt;/p&gt;

&lt;p&gt;GitHub Actions for CI/CD,&lt;/p&gt;

&lt;p&gt;And Astro as the static site framework (can easily be swapped for others like Hugo or Jekyll).&lt;/p&gt;

&lt;p&gt;The entire process—from infrastructure provisioning to code deployment—is triggered on every push to the main branch. It’s a clean, serverless-free solution leveraging IaaS for simplicity and control.&lt;/p&gt;

&lt;p&gt;🔗 Live Demo Link&lt;br&gt;
👉 http://&lt;br&gt;
(Replace this with your EC2 public IP or domain)&lt;/p&gt;

&lt;p&gt;📦 Project Repo&lt;br&gt;
🧰 GitHub Repository: github.com/yourusername/fast-static-deploy&lt;br&gt;
(Be sure to include a README with steps, architecture, and how to replicate the deployment!)&lt;/p&gt;

&lt;p&gt;✍️ My Journey&lt;br&gt;
This project started as a way to explore how fast and repeatable static site deployments could be using IaaS rather than managed services like Netlify or Vercel.&lt;/p&gt;

&lt;p&gt;Key Milestones:&lt;br&gt;
Static Site Creation – I used Astro for its quick setup and zero-JS static rendering.&lt;/p&gt;

&lt;p&gt;Pulumi Setup – Defined an EC2 instance, security group, and userData script to install and configure Nginx.&lt;/p&gt;

&lt;p&gt;GitHub Actions – Integrated Pulumi into the CI/CD pipeline and added an SCP step to upload the built static files to the EC2 instance.&lt;/p&gt;

&lt;p&gt;Secrets Management – Stored Pulumi token, AWS keys, and EC2 SSH key securely in GitHub Secrets.&lt;/p&gt;

&lt;p&gt;Challenges I Faced:&lt;br&gt;
EC2 AMI choice and default user (ec2-user for Amazon Linux).&lt;/p&gt;

&lt;p&gt;Setting up Pulumi authentication properly in GitHub Actions.&lt;/p&gt;

&lt;p&gt;SCP to EC2: Ensuring the SSH key had proper permissions and that Nginx was serving the right folder.&lt;/p&gt;

&lt;p&gt;What I Learned:&lt;br&gt;
Pulumi’s type-safe infrastructure-as-code approach is intuitive and powerful.&lt;/p&gt;

&lt;p&gt;GitHub Actions make CI/CD effortless with great community actions (e.g., scp-action).&lt;/p&gt;

&lt;p&gt;Full control over infrastructure helps you understand deployment deeply—great for learning and production-ready work.&lt;/p&gt;

&lt;p&gt;⚙️ Using Pulumi&lt;br&gt;
Pulumi was the backbone of this project’s infrastructure. Here's how I used it:&lt;/p&gt;

&lt;p&gt;Provisioned EC2 Instance with Nginx and configured it via userData.&lt;/p&gt;

&lt;p&gt;Created Security Group to allow HTTP traffic.&lt;/p&gt;

&lt;p&gt;Defined Outputs for public IP, which was picked up in the GitHub Action.&lt;/p&gt;

&lt;p&gt;Here’s a simplified Pulumi (TypeScript) snippet I used:&lt;/p&gt;

&lt;p&gt;ts&lt;/p&gt;

&lt;p&gt;const server = new aws.ec2.Instance("web-server", {&lt;br&gt;
  ami: "ami-0c02fb55956c7d316",&lt;br&gt;
  instanceType: "t2.micro",&lt;br&gt;
  securityGroups: [group.name],&lt;br&gt;
  userData: &lt;code&gt;&lt;br&gt;
    #!/bin/bash&lt;br&gt;
    sudo yum install -y nginx&lt;br&gt;
    sudo systemctl start nginx&lt;br&gt;
    sudo systemctl enable nginx&lt;br&gt;
&lt;/code&gt;,&lt;br&gt;
});&lt;br&gt;
GitHub Actions + Pulumi:&lt;br&gt;
I used the Pulumi GitHub Action to run pulumi up on every push to main. After that, I added an SCP step to deploy the static files:&lt;/p&gt;

&lt;p&gt;yaml&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;name: Deploy files to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ec2-user
key: ${{ secrets.EC2_SSH_KEY }}
source: "dist/"
target: "/usr/share/nginx/html"
Pulumi made the whole provisioning process more robust and transparent. Everything is in code. I could destroy or recreate the infrastructure in minutes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🎉 Thanks Pulumi &amp;amp; DEV for this awesome challenge!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>pulumichallenge</category>
      <category>webdev</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
