<?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: Abhishek Jha</title>
    <description>The latest articles on DEV Community by Abhishek Jha (@abhishek365).</description>
    <link>https://dev.to/abhishek365</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%2F3251512%2F328f9ad8-0664-4b73-817f-dea4b3d1c163.png</url>
      <title>DEV Community: Abhishek Jha</title>
      <link>https://dev.to/abhishek365</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abhishek365"/>
    <language>en</language>
    <item>
      <title>🔐 How I Established SSH Connection Between Two AWS EC2 Instances</title>
      <dc:creator>Abhishek Jha</dc:creator>
      <pubDate>Fri, 13 Jun 2025 17:37:37 +0000</pubDate>
      <link>https://dev.to/abhishek365/how-i-established-ssh-connection-between-two-aws-ec2-instances-dlc</link>
      <guid>https://dev.to/abhishek365/how-i-established-ssh-connection-between-two-aws-ec2-instances-dlc</guid>
      <description>&lt;p&gt;Hey everyone! 👋&lt;/p&gt;

&lt;p&gt;Today, I want to share a new concept I learned while working with AWS — establishing an SSH connection between two EC2 instances. It might sound simple, but it’s a foundational skill if you're diving deeper into networking, automation, or setting up multi-node systems like clusters, load balancers, or databases.&lt;/p&gt;

&lt;p&gt;Let me walk you through the process, the purpose, and the lessons I picked up along the way!&lt;/p&gt;

&lt;h2&gt;
  
  
  🧾 Why I Did It
&lt;/h2&gt;

&lt;p&gt;In real-world cloud infrastructure setups, different EC2 instances often need to communicate with each other — for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;One EC2 acts as a controller or bastion host.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need to run scripts remotely on another EC2 instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You're building a distributed application and want to pass data internally between nodes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To do this securely, you set up an SSH connection from one EC2 to another using a private key.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ What I Did
&lt;/h2&gt;

&lt;p&gt;Here’s the exact process I followed to set up SSH between two Ubuntu-based EC2 instances:&lt;/p&gt;

&lt;p&gt;✅ Step 1: Create 2 EC2 Instances&lt;br&gt;
I launched two EC2 instances in the same VPC and availability zone. Let's call them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;EC2-A (Source machine)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;EC2-B (Target machine)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ Step 2: Copy EC2-B's Private Key to EC2-A&lt;br&gt;
I securely copied the private key (PEM file) used to launch EC2-B into EC2-A using scp.&lt;/p&gt;

&lt;p&gt;✅ Step 3: Adjust EC2-B's Security Group&lt;br&gt;
In EC2-B's security group, I added an inbound rule to allow SSH (port 22) from EC2-A's private IP.&lt;/p&gt;

&lt;p&gt;This ensures only EC2-A can initiate SSH connections to EC2-B — a best practice in cloud security.&lt;/p&gt;

&lt;p&gt;✅ Step 4: SSH from EC2-A to EC2-B&lt;br&gt;
Once everything was set, I SSHed into EC2-A and ran:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh -i "ec2-b-key.pem" ubuntu@&amp;lt;private-ip-of-ec2-b&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;And boom 💥 — I was inside EC2-B from EC2-A!&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Something I Faced
&lt;/h2&gt;

&lt;p&gt;One issue I initially ran into:&lt;br&gt;
Even after copying the PEM file and setting the correct permissions (chmod 400), I was getting &lt;strong&gt;"Permission denied (publickey)"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Turns out I hadn’t allowed EC2-A’s IP in EC2-B’s security group. Once I fixed that — the SSH worked like a charm.&lt;/p&gt;

&lt;h2&gt;
  
  
  📚 What I Learned
&lt;/h2&gt;

&lt;p&gt;✅ How EC2 instances communicate within a private VPC&lt;br&gt;
✅ Setting up secure SSH connections between two cloud servers&lt;br&gt;
✅ Importance of security group configurations and IP restrictions&lt;br&gt;
✅ Handling PEM keys and access control responsibly&lt;/p&gt;

&lt;p&gt;This might seem like a small step, but it opens the door to bigger possibilities like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Automating deployments from one EC2 to another&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setting up internal-only communication for microservices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Managing remote scripts or server orchestration&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Cloud networking and EC2 configurations may look scary at first, but once you start doing it hands-on — it becomes clear, logical, and even fun.&lt;/p&gt;

&lt;p&gt;If you're starting with AWS or EC2, I highly recommend practicing internal SSH setups — it’ll give you confidence in managing infrastructure securely and efficiently.&lt;/p&gt;

&lt;p&gt;Thanks for reading! If this helped you or if you’ve done something similar, feel free to:&lt;/p&gt;

&lt;p&gt;💬 Drop a comment&lt;br&gt;
🧡 React to this post&lt;br&gt;
📌 Save it for later&lt;/p&gt;

&lt;p&gt;Let’s keep exploring, experimenting, and learning! 🚀&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>aws</category>
      <category>linux</category>
    </item>
    <item>
      <title>🚀 How I Dockerized My Java Spring Boot App and Deployed It on AWS EC2</title>
      <dc:creator>Abhishek Jha</dc:creator>
      <pubDate>Sat, 07 Jun 2025 19:20:31 +0000</pubDate>
      <link>https://dev.to/abhishek365/how-i-dockerized-my-java-spring-boot-app-and-deployed-it-on-aws-ec2-9ki</link>
      <guid>https://dev.to/abhishek365/how-i-dockerized-my-java-spring-boot-app-and-deployed-it-on-aws-ec2-9ki</guid>
      <description>&lt;p&gt;Hey everyone! 👋&lt;/p&gt;

&lt;p&gt;I recently completed a project that really leveled up my understanding of DevOps, Java backend development, and cloud deployment — and I wanted to share my experience in case you're starting your journey or exploring similar tools.&lt;/p&gt;

&lt;p&gt;I built and deployed a full-stack Expenses Tracker Web App, where I used technologies like &lt;strong&gt;Spring Boot, Docker, Docker Compose, and AWS EC2&lt;/strong&gt;. It’s the first time I’ve dockerized a real-world application and deployed it on a live server, and it taught me a ton about backend systems, containerization, and cloud environments.&lt;/p&gt;

&lt;p&gt;Let me walk you through the journey, what I built, how I deployed it, the challenges I faced, and what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧾 Project Overview: Expenses Tracker Web App
&lt;/h2&gt;

&lt;p&gt;The goal was to create a simple but functional expense tracking system where users could:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Register and log in securely&lt;/li&gt;
&lt;li&gt;Add, view, and delete their expenses&lt;/li&gt;
&lt;li&gt;View a summary of their spending&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠️ Technologies I Used
&lt;/h2&gt;

&lt;p&gt;This project brought together several technologies across development and deployment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java and Spring Boot (core application logic)&lt;/li&gt;
&lt;li&gt;Spring Security (for authentication)&lt;/li&gt;
&lt;li&gt;Spring Data JPA + MySQL (for database integration)&lt;/li&gt;
&lt;li&gt;Thymeleaf + Bootstrap (for frontend templating and styling)&lt;/li&gt;
&lt;li&gt;Docker &amp;amp; Docker Compose (for containerization)&lt;/li&gt;
&lt;li&gt;Amazon EC2 (Ubuntu) (for hosting the app)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these played a key role in building a complete, modular, and scalable web application.&lt;/p&gt;

&lt;h2&gt;
  
  
  🐳 Dockerizing the Application
&lt;/h2&gt;

&lt;p&gt;One of my main goals was to learn how to containerize a Java application using Docker. I created a &lt;em&gt;&lt;strong&gt;Dockerfile&lt;/strong&gt;&lt;/em&gt; that builds and runs the Spring Boot app, and used &lt;strong&gt;Docker Compose&lt;/strong&gt; to spin up both the application and a MySQL database together in isolated containers.&lt;/p&gt;

&lt;p&gt;This approach makes the app environment-independent and super easy to run on any server or system that supports Docker.&lt;/p&gt;

&lt;p&gt;It also taught me how important it is to properly handle environment variables (like DB connection strings) for cleaner config management and better security.&lt;/p&gt;

&lt;h2&gt;
  
  
  ☁️ Deploying on AWS EC2
&lt;/h2&gt;

&lt;p&gt;Once my app was running smoothly in Docker locally, I moved to the cloud.&lt;/p&gt;

&lt;p&gt;I launched an EC2 Ubuntu instance on AWS and installed Docker and Docker Compose. After pushing my project to GitHub, I cloned it into the EC2 server and ran everything using Docker Compose. I also configured AWS security groups to allow traffic on the correct ports.&lt;/p&gt;

&lt;p&gt;In just a few steps, I had a live server running my app — all from the cloud. It felt amazing to see something I built locally available on a public IP address for the world to access.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 A Problem I Faced (and Solved)
&lt;/h2&gt;

&lt;p&gt;One interesting challenge I faced while working with Docker Compose was related to service-to-service communication.&lt;/p&gt;

&lt;p&gt;At first, my Spring Boot app couldn’t connect to the MySQL container. After digging in, I realized the issue was that I was trying to connect using &lt;em&gt;&lt;strong&gt;localhost&lt;/strong&gt;&lt;/em&gt; instead of the Docker service name defined in the Compose file.&lt;/p&gt;

&lt;p&gt;Once I changed the database hostname to match the service name (mysql in my case), the connection worked perfectly. It was a small but valuable lesson about how Docker networking works in multi-container setups.&lt;/p&gt;

&lt;h2&gt;
  
  
  📚 What I Learned
&lt;/h2&gt;

&lt;p&gt;This project gave me hands-on experience with several critical concepts and tools that are extremely relevant in real-world software development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;✅ How to containerize a full-stack Java web application using Docker&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;✅ How to write and structure a Docker Compose file for multi-container setups&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;✅ The importance of environment variables and clean configuration&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;✅ How to launch and configure an EC2 instance on AWS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;✅ Managing cloud infrastructure (ports, SSH, Docker setup)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;✅ Debugging common DevOps and deployment issues&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most importantly, it taught me how to go from idea ➝ working app ➝ running cloud deployment — something I can now repeat and improve on with future projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔗 Check Out the Project
&lt;/h2&gt;

&lt;p&gt;The full source code is available on my GitHub:&lt;br&gt;
👉 &lt;a href="https://github.com/abhijha16/Dockerized-Expenses-Tracker-WebApp" rel="noopener noreferrer"&gt;Dockerized-Expenses-Tracker-WebApp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to explore the code, run it yourself, or reach out if you have questions!&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 What’s Next?
&lt;/h2&gt;

&lt;p&gt;I'm excited to keep building and improving. Here are a few things I want to work on next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Add an Nginx reverse proxy for better scalability and HTTPS support&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Explore CI/CD with GitHub Actions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try PostgreSQL as an alternative DB engine&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learn about Kubernetes for orchestrating containers at scale&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a frontend container and host both under a single domain&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🧠 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;If you're just starting out with Docker, Java, or AWS, my advice is simple: build something real. You'll hit problems. You’ll read docs. You’ll break things. And then, you'll fix them — and learn deeply from the process.&lt;/p&gt;

&lt;p&gt;Thanks for reading! If you enjoyed this, found it helpful, or have questions, feel free to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;💬 Leave a comment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;🧡 React to this post&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s keep building, breaking, and learning 🚀&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>aws</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
