<?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"><channel><title><![CDATA[Zero-Touch Node.js Deployments on AWS]]></title><description><![CDATA[Zero-Touch Node.js Deployments on AWS]]></description><link>https://zero-touch-nodejs-deployments-on-aws.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 18:55:05 GMT</lastBuildDate><atom:link href="https://zero-touch-nodejs-deployments-on-aws.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How I Automated a Node.js Login Page Deployment with Terraform & Bitbucket Pipelines]]></title><description><![CDATA[I got tired of manually deploying my Node.js login page to Elastic Beanstalk env via the AWS Console, so I automated everything from infrastructure to CI/CD using Terraform and Bitbucket Pipelines. Here’s the step-by-step breakdown.

1. The Challenge...]]></description><link>https://zero-touch-nodejs-deployments-on-aws.hashnode.dev/how-i-automated-a-nodejs-login-page-deployment-with-terraform-and-bitbucket-pipelines</link><guid isPermaLink="true">https://zero-touch-nodejs-deployments-on-aws.hashnode.dev/how-i-automated-a-nodejs-login-page-deployment-with-terraform-and-bitbucket-pipelines</guid><dc:creator><![CDATA[Dahiru Ahmed]]></dc:creator><pubDate>Tue, 13 May 2025 12:47:31 GMT</pubDate><content:encoded><![CDATA[<p><em>I got tired of manually deploying my Node.js login page to Elastic Beanstalk env via the AWS Console, so I automated everything from infrastructure to CI/CD using Terraform and Bitbucket Pipelines. Here’s the step-by-step breakdown.</em></p>
<hr />
<h4 id="heading-1-the-challenge-manual-deployments-on-aws"><strong>1. The Challenge: Manual Deployments on AWS</strong></h4>
<ul>
<li><p><strong>Pain Points</strong>:</p>
<ul>
<li><p>Time-consuming EB environment setup (VPC, security groups, scaling).</p>
</li>
<li><p>No version control for infrastructure.</p>
</li>
<li><p>Manual code uploads via AWS Console.</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-2-infrastructure-as-code-with-terraform"><strong>2. Infrastructure as Code with Terraform</strong></h4>
<ul>
<li><p><strong>Key Terraform Configurations</strong>:</p>
<ul>
<li><p><strong>S3 Backend</strong>: Stored state files securely to enable team collaboration.</p>
<pre><code class="lang-plaintext">  terraform {
    backend "s3" {
      bucket = "my-terraform-state-bucket"
      key    = "elastic-beanstalk/terraform.tfstate"
      region = "us-east-1"
    }
  }
</code></pre>
</li>
<li><p><strong>Elastic Beanstalk Setup</strong>: Defined environment, instance type, and auto-scaling.</p>
</li>
<li><p><strong>Networking</strong>: VPC, subnets, and security groups (restricted to HTTP/HTTPS).</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-3-cicd-with-bitbucket-pipelines"><strong>3. CI/CD with Bitbucket Pipelines</strong></h4>
<ul>
<li><p><strong>Pipeline Workflow</strong>:</p>
<ol>
<li><p><strong>Code Push</strong>: Triggered pipeline on <code>git push</code> (via VS Code terminal).</p>
</li>
<li><p><strong>Test &amp; Build</strong>: Ran <code>npm install</code> and basic smoke tests.</p>
</li>
<li><p><strong>Deploy</strong>: Used <code>aws elasticbeanstalk deploy</code> to update the EB environment.</p>
</li>
</ol>
</li>
<li><p><strong>Sample</strong> <code>bitbucket-pipelines.yml</code>:</p>
<pre><code class="lang-yaml">  <span class="hljs-attr">image:</span> <span class="hljs-string">node:14</span>
  <span class="hljs-attr">pipelines:</span>
    <span class="hljs-attr">branches:</span>
      <span class="hljs-attr">main:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">step:</span>
            <span class="hljs-attr">script:</span>
              <span class="hljs-bullet">-</span> <span class="hljs-string">npm</span> <span class="hljs-string">install</span>
              <span class="hljs-bullet">-</span> <span class="hljs-string">npm</span> <span class="hljs-string">test</span>
              <span class="hljs-bullet">-</span> <span class="hljs-string">zip</span> <span class="hljs-string">-r</span> <span class="hljs-string">deploy.zip</span> <span class="hljs-string">.</span>
              <span class="hljs-bullet">-</span> <span class="hljs-attr">pipe:</span> <span class="hljs-string">atlassian/aws-elasticbeanstalk-deploy:1.1.0</span>
                <span class="hljs-attr">variables:</span>
                  <span class="hljs-attr">AWS_ACCESS_KEY_ID:</span> <span class="hljs-string">$AWS_ACCESS_KEY_ID</span>
                  <span class="hljs-attr">AWS_SECRET_ACCESS_KEY:</span> <span class="hljs-string">$AWS_SECRET_ACCESS_KEY</span>
                  <span class="hljs-attr">AWS_DEFAULT_REGION:</span> <span class="hljs-string">"us-east-1"</span>
                  <span class="hljs-attr">APPLICATION_NAME:</span> <span class="hljs-string">"my-login-app"</span>
                  <span class="hljs-attr">ENVIRONMENT_NAME:</span> <span class="hljs-string">"login-app-prod"</span>
                  <span class="hljs-attr">ZIP_FILE:</span> <span class="hljs-string">"deploy.zip"</span>
</code></pre>
</li>
</ul>
<h4 id="heading-4-the-result-fully-automated-deployments"><strong>4. The Result: Fully Automated Deployments</strong></h4>
<ul>
<li><p><strong>Achievements</strong>:</p>
<ul>
<li><p><strong>Infrastructure in Version Control</strong>: Terraform files are tracked in Bitbucket.</p>
</li>
<li><p><strong>1-Click Deploys</strong>: Code changes are deployed automatically to EB.</p>
</li>
<li><p><strong>Cost Savings</strong>: Eliminated manual errors and reduced deployment time by 80%.</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-5-lessons-learned"><strong>5. Lessons Learned</strong></h4>
<ul>
<li><p><strong>Terraform State</strong>: Always use <strong>remote backends (S3)</strong> to avoid state conflicts.</p>
</li>
<li><p><strong>Pipeline Security</strong>: Store AWS credentials as <strong>Bitbucket environment variables</strong>.</p>
</li>
<li><p><strong>EB Extensions</strong>: Use <code>.ebextensions/</code> to customize EB environments (e.g., NGINX configs).</p>
</li>
</ul>
<h4 id="heading-conclusion"><strong>Conclusion</strong></h4>
<blockquote>
<p><em>Automating deployments with Terraform and Bitbucket Pipelines turned a tedious process into a seamless workflow. Next up: Adding multi-stage environments (dev/staging/prod).</em></p>
</blockquote>
]]></content:encoded></item></channel></rss>