<?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: Soumen Bhunia</title>
    <description>The latest articles on DEV Community by Soumen Bhunia (@soumen_bhunia).</description>
    <link>https://dev.to/soumen_bhunia</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%2F3183015%2F2a6c7de0-bae6-4912-9ada-06deb4a87197.jpg</url>
      <title>DEV Community: Soumen Bhunia</title>
      <link>https://dev.to/soumen_bhunia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/soumen_bhunia"/>
    <language>en</language>
    <item>
      <title>Building and Deploying a React App on Kubernetes</title>
      <dc:creator>Soumen Bhunia</dc:creator>
      <pubDate>Wed, 28 May 2025 15:56:39 +0000</pubDate>
      <link>https://dev.to/soumen_bhunia/building-and-deploying-a-react-app-on-kubernetes-1a4</link>
      <guid>https://dev.to/soumen_bhunia/building-and-deploying-a-react-app-on-kubernetes-1a4</guid>
      <description>&lt;p&gt;In this blog, I’ll walk you through the complete process of &lt;strong&gt;creating a React app&lt;/strong&gt;, containerizing it with &lt;strong&gt;Docker&lt;/strong&gt;, and deploying it to a &lt;strong&gt;Kubernetes cluster&lt;/strong&gt; using &lt;strong&gt;Minikube&lt;/strong&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Creating a New React App&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;First, I created a new React application using the &lt;code&gt;create-react-app&lt;/code&gt; tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app testapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During the creation, I saw some deprecation warnings about certain Node modules. This is because &lt;code&gt;create-react-app&lt;/code&gt; is deprecated, but it’s still usable for learning purposes.&lt;/p&gt;

&lt;p&gt;After the installation, the app was created in the &lt;code&gt;testapp&lt;/code&gt; folder. I confirmed this by checking that these scripts were available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;npm start&lt;/code&gt; – to start the development server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm run build&lt;/code&gt; – to create a production build.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm test&lt;/code&gt; – to run tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Running the App Locally&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I switched to the project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;testapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, I started the development server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This successfully launched the React app locally at &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3: Writing a Dockerfile&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To containerize the app, I created a &lt;code&gt;Dockerfile&lt;/code&gt; in the project root directory (&lt;code&gt;testapp&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /myapp&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;

&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3000&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["npm", "start"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s what’s happening:&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;FROM node&lt;/strong&gt; – Using the official Node.js image.&lt;br&gt;
✅ &lt;strong&gt;WORKDIR /myapp&lt;/strong&gt; – Setting the working directory inside the container.&lt;br&gt;
✅ &lt;strong&gt;COPY . .&lt;/strong&gt; – Copying project files to the container.&lt;br&gt;
✅ &lt;strong&gt;RUN npm install&lt;/strong&gt; – Installing dependencies.&lt;br&gt;
✅ &lt;strong&gt;EXPOSE 3000&lt;/strong&gt; – Exposing port 3000 for the app.&lt;br&gt;
✅ &lt;strong&gt;CMD ["npm", "start"]&lt;/strong&gt; – Default command to run when the container starts.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4: Building the Docker Image&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I built the Docker image and tagged it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; nextgensoumen/webapp-demo &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After building, I confirmed the image was created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 5: Pushing the Image to Docker Hub&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To make the image accessible to Kubernetes, I pushed it to my Docker Hub account:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker login
docker push nextgensoumen/webapp-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures that Kubernetes can pull the image from the Docker registry.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 6: Deploying the App on Kubernetes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I used &lt;strong&gt;kubectl&lt;/strong&gt; to create a deployment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl create deployment my-webapp &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;nextgensoumen/webapp-demo:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, I checked the status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get deployments
kubectl get pods
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initially, the pod status showed &lt;strong&gt;ContainerCreating&lt;/strong&gt;, which means it was pulling the image and setting up.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 7: Exposing the Deployment as a Service&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To access the app from outside the cluster, I exposed the deployment as a &lt;strong&gt;LoadBalancer service&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl expose deployment my-webapp &lt;span class="nt"&gt;--type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;LoadBalancer &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I verified the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get services
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 8: Accessing the App with Minikube&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Since I was using &lt;strong&gt;Minikube&lt;/strong&gt;, I used the &lt;code&gt;minikube service&lt;/code&gt; command to get the service URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minikube service my-webapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Minikube provided a local URL, e.g., &lt;a href="http://127.0.0.1:63339" rel="noopener noreferrer"&gt;http://127.0.0.1:63339&lt;/a&gt;, that I could open in the browser to see my React app running in the cluster!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Optional: Rebuilding and Redeploying&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;After some updates, I built a new Docker image with a different tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; nextgensoumen/webapp-demo:01 &lt;span class="nb"&gt;.&lt;/span&gt;
docker push nextgensoumen/webapp-demo:01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, I updated the deployment in Kubernetes to use the new image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl &lt;span class="nb"&gt;set &lt;/span&gt;image deployment/my-webapp my-webapp&lt;span class="o"&gt;=&lt;/span&gt;nextgensoumen/webapp-demo:01
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Main points&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Created a React app with &lt;code&gt;create-react-app&lt;/code&gt;.&lt;br&gt;
 Containerized it using Docker with a simple &lt;code&gt;Dockerfile&lt;/code&gt;.&lt;br&gt;
 Pushed the image to Docker Hub for accessibility.&lt;br&gt;
 Deployed it on Kubernetes using &lt;strong&gt;kubectl&lt;/strong&gt;.&lt;br&gt;
 Exposed the service with a &lt;strong&gt;LoadBalancer&lt;/strong&gt; for external access.&lt;br&gt;
 Used &lt;strong&gt;Minikube&lt;/strong&gt; to tunnel and access the service locally.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Bonus Tips&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Watch for Deprecated Packages&lt;/strong&gt;: During &lt;code&gt;npm install&lt;/code&gt;, there were many deprecation warnings. Consider using newer React frameworks like &lt;strong&gt;Vite&lt;/strong&gt; or &lt;strong&gt;Next.js&lt;/strong&gt; for future projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep Docker Images Lean&lt;/strong&gt;: Use &lt;code&gt;node:alpine&lt;/code&gt; or multi-stage builds to reduce image size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manage K8s Resources&lt;/strong&gt;: Use &lt;code&gt;kubectl delete&lt;/code&gt; to remove deployments and services when done.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use &lt;code&gt;kubectl rollout status&lt;/code&gt;&lt;/strong&gt;: Helpful for checking deployment updates:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  kubectl rollout status deployment/my-webapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Example: Rolling Back a Failed Deployment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Let’s imagine I tried to update my app’s image to a non-existent version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl &lt;span class="nb"&gt;set &lt;/span&gt;image deployment/my-webapp my-webapp&lt;span class="o"&gt;=&lt;/span&gt;nextgensoumen/webapp-demo:08
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the &lt;code&gt;nextgensoumen/webapp-demo:08&lt;/code&gt; tag doesn’t exist in Docker Hub, Kubernetes couldn’t pull the image.&lt;/p&gt;

&lt;p&gt;When I checked the pods:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pods
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I saw something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NAME                          READY   STATUS             RESTARTS   AGE
my-webapp-85d74c444f-abcde   0/1     ImagePullBackOff   0          1m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means Kubernetes was &lt;strong&gt;unable to pull the image&lt;/strong&gt; and couldn’t start the container.&lt;/p&gt;

&lt;p&gt;I also checked the rollout status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout status deployment/my-webapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It showed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Waiting for deployment "my-webapp" rollout to finish: 1 old replicas are pending termination...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kubernetes was stuck because it couldn’t successfully start new pods.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Rolling Back to a Previous Working Version&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To fix this, I &lt;strong&gt;rolled back the deployment&lt;/strong&gt; to the previous known good version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout undo deployment/my-webapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command &lt;strong&gt;restored the previous working image&lt;/strong&gt; automatically. After the rollback, I checked the rollout status again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl rollout status deployment/my-webapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It showed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;deployment "my-webapp" successfully rolled out
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The app was now back to its &lt;strong&gt;previous stable version&lt;/strong&gt; and running smoothly!&lt;/p&gt;

&lt;h2&gt;
  
  
  Thanks for Reading!
&lt;/h2&gt;

&lt;p&gt;Hope this gives you some perspective.&lt;/p&gt;

&lt;h3&gt;
  
  
  Coming Up Next:
&lt;/h3&gt;

&lt;p&gt;More hands-on cloud projects and DevOps tips — stay tuned!&lt;/p&gt;

&lt;h3&gt;
  
  
  Let’s Connect:
&lt;/h3&gt;

&lt;p&gt;Share your thoughts in the comments or reach out on &lt;a href="https://www.linkedin.com/in/soumen-bhunia/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;. Your feedback means a lot!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;GitHub Code&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You can find the complete source code for this project on my GitHub:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Alpha-Soumen/DevOps_Projects/tree/main/React-docker-k8s-app/testapp" rel="noopener noreferrer"&gt;GitHub Repository: testapp React Docker K8s Example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>react</category>
      <category>kubernetes</category>
      <category>docker</category>
    </item>
    <item>
      <title>Deploy My First Node.js App on AWS: EC2 + Docker + RDS MySQL Explained</title>
      <dc:creator>Soumen Bhunia</dc:creator>
      <pubDate>Tue, 20 May 2025 11:52:34 +0000</pubDate>
      <link>https://dev.to/soumen_bhunia/deploy-my-first-nodejs-app-on-aws-ec2-docker-rds-mysql-explained-39hn</link>
      <guid>https://dev.to/soumen_bhunia/deploy-my-first-nodejs-app-on-aws-ec2-docker-rds-mysql-explained-39hn</guid>
      <description>&lt;p&gt;Hi everyone, &lt;br&gt;
My name is Soumen Bhunia. This is my first blog. In this blog, I build and deploy my first Node.js app using Docker, hosted on an AWS EC2 instance, and connected to a MySQL database hosted via Amazon RDS&lt;/p&gt;
&lt;h2&gt;
  
  
  Technologies Used
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nodejs.org/" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt; – JavaScript runtime to build the server-side app&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt; Docker&lt;/a&gt; – For containerizing the Node.js app&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://aws.amazon.com/ec2/" rel="noopener noreferrer"&gt;Amazon EC2&lt;/a&gt; – Virtual server for running the Docker container&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://aws.amazon.com/rds/" rel="noopener noreferrer"&gt;Amazon RDS (MySQL)&lt;/a&gt; – Managed MySQL database service&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html" rel="noopener noreferrer"&gt;AWS Security Groups&lt;/a&gt; – For access control to EC2 and RDS&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Step-by-Step Setup Guide
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Step 1: Create an RDS MySQL Instance
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://console.aws.amazon.com/rds/" rel="noopener noreferrer"&gt;Amazon RDS Console&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Database&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Engine type&lt;/strong&gt;: MySQL
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use case&lt;/strong&gt;: Free Tier
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Settings&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Set a &lt;strong&gt;DB instance identifier&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Master username&lt;/strong&gt;: &lt;code&gt;admin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Master password&lt;/strong&gt;: Set a secure password (avoid special characters like &lt;code&gt;@&lt;/code&gt;, &lt;code&gt;%&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Connectivity&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Enable &lt;strong&gt;Public access = Yes&lt;/strong&gt; (for development purposes)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a new VPC security group&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add an &lt;strong&gt;inbound rule&lt;/strong&gt; to allow MySQL/Aurora (port &lt;code&gt;3306&lt;/code&gt;) from &lt;strong&gt;Anywhere (0.0.0.0/0)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After RDS is created, copy the &lt;strong&gt;endpoint/hostname&lt;/strong&gt; — you'll use it to connect your app to the database.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 2: Launch and Configure an EC2 Instance
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to &lt;a href="https://console.aws.amazon.com/ec2/" rel="noopener noreferrer"&gt;Amazon EC2 Console&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Launch a new instance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Linux 2 AMI&lt;/strong&gt; (Free Tier eligible)
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;t2.micro&lt;/strong&gt; (Free Tier)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;Security Group&lt;/strong&gt;, allow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP (port 80)&lt;/strong&gt; – for web traffic
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH (port 22)&lt;/strong&gt; – for connecting to the instance
&lt;/li&gt;
&lt;li&gt;Optional: Restrict access by IP for SSH&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Step 3: Install Docker on EC2
&lt;/h3&gt;

&lt;p&gt;Once connected to EC2, run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;yum update &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; docker
&lt;span class="nb"&gt;sudo &lt;/span&gt;service docker start
&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; docker ec2-user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: Log out and log back in to activate Docker permissions for &lt;code&gt;ec2-user&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Run the Dockerized Node.js App
&lt;/h3&gt;

&lt;p&gt;Pull the Docker image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;docker pull philippaul/node-mysql-app:02
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run your container, replacing the values with your actual RDS credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 80:3000 &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;DB_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-db-endpoint.rds.amazonaws.com"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;DB_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"admin"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-db-password"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-d&lt;/span&gt; philippaul/node-mysql-app:02
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your app should now be accessible at your EC2 public IP on port 80.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web interface screenshot
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fao351zhqob5vnvkofm6e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fao351zhqob5vnvkofm6e.png" alt="web interface image" width="800" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Optional: Test the MySQL Connection
&lt;/h3&gt;

&lt;p&gt;You can test connecting to the database from inside EC2 using a MySQL Docker client:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; mysql:8.0 mysql &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-h&lt;/span&gt; your-db-endpoint.rds.amazonaws.com &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;-u&lt;/span&gt; admin &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter your password when prompted. If you connect successfully — your EC2 can talk to your RDS instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thanks for Reading!
&lt;/h2&gt;

&lt;p&gt;Hope this gives you some perspective.&lt;/p&gt;

&lt;h3&gt;
  
  
  Coming Up Next:
&lt;/h3&gt;

&lt;p&gt;More hands-on cloud projects and DevOps tips — stay tuned!&lt;/p&gt;

&lt;h3&gt;
  
  
  Let’s Connect:
&lt;/h3&gt;

&lt;p&gt;Share your thoughts in the comments or reach out on &lt;a href="https://www.linkedin.com/in/soumen-bhunia/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.Your feedback means a lot!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>rds</category>
      <category>ec2</category>
      <category>docker</category>
    </item>
  </channel>
</rss>
