pwshub.com

How to Connect to Your EC2 Instance Using MobaXterm with SSH and a Keypair (.pem) File

How to Connect to Your EC2 Instance Using MobaXterm with SSH and a Keypair (.pem) File

In this article, I’ll walk you through the steps of connecting to your EC2 instance using MobaXterm with a .pem keypair file. Whether you're a beginner dipping your toes into the cloud or an experienced user looking for a quicker method, I’ve got you covered. So, let’s dive in!

Table of Contents

  • Why MobaXterm?

  • Step 1: Install MobaXterm

  • Step 2: Get Your EC2 Instance Public IP and Key Pair

  • Step 3: Open MobaXterm and Start a New SSH Session

  • Step 4: Enter SSH Session Details

  • Step 5: Attach Your .pem Key Pair

  • Step 6: Connect to Your EC2 Instance

  • Step 7: Troubleshooting Common Issues

  • Wrapping Up

You may be wondering why we’re using MobaXterm over other SSH tools. Well, for starters, it’s super beginner-friendly, and it combines a bunch of powerful tools in one. You can use it to transfer files, run scripts, or even open multiple sessions simultaneously.

Plus, it’s like the Swiss Army knife for remote connections. Whether you’re working with AWS, Google Cloud, or even a Raspberry Pi at home, MobaXterm can do it all.

Step 1: Install MobaXterm

If you’re not already familiar with MobaXterm, it’s basically used for all things remote access. You can download it here for free. Installation is super easy – just download, click, and install.

Once you have it set up, fire up MobaXterm and get ready for the fun part.

Step 2: Get Your EC2 Instance Public IP and Key Pair

Before we continue, there are two key pieces of information you’ll need:

Public IP Address: This is the unique address AWS assigns to your EC2 instance. To find it, go to the EC2 Dashboard in AWS, select your running instance, and grab the Public IPv4 Address (it looks like 13.123.45.67).

Your .pem File: This is the private key file you downloaded when you created your EC2 instance. If you didn’t save it, you may have to create a new key pair because AWS only lets you download it once. (No pressure – just don’t lose it this time!)

Step 3: Open MobaXterm and Start a New SSH Session

Time to work some magic with MobaXterm! Open the app, and you’ll see an intuitive interface. Don’t let all the buttons scare you, just focus on the top left where it says Session.

MobaXterm user interface

Here’s what to do next:

  • Click Session (you’ll feel powerful just pressing that button).

  • In the new window, select SSH as the session type.

MobaXterm Session setting tab

Step 4: Enter SSH Session Details

It’s time to fill in the details that’ll connect MobaXterm to your EC2 instance. Here’s what you need to know:

  • Remote Host: Enter the Public IP Address of your EC2 instance here. Remember, you grabbed that from the EC2 Dashboard earlier.

  • Username: If you’re using Amazon Linux, your default username is ec2-user. If you’re on Ubuntu, it’s ubuntu.

Step 5: Attach Your .pem Key Pair

MobaXterm makes it super easy to use your .pem key file for authentication (no converting to .ppk necessary, like you’d have to with other tools).

Here’s how to attach your .pem file:

  • Head over to the Advanced SSH Settings tab.

  • Check the Use private key option.

  • Click Browse and find your .pem file on your computer.

  • Select the file and hit OK.

It’s like giving MobaXterm the secret key to unlock your EC2 instance.

535c226e-fbd2-43fc-b1af-a48ce171b974

Step 6: Connect to Your EC2 Instance

Now that you’ve filled in all the details, click OK to start your session. If everything’s been set up correctly, you should see a terminal pop up, and MobaXterm will work its magic to connect you to your EC2 instance.

🎉 And just like that, you’re in! You should see a terminal window connected to your instance, and now you can start typing commands like a pro.

Step 7: Troubleshooting Common Issues

We all know that tech doesn’t always behave. Here are some common problems you might run into—and how to solve them:

  • Connection Timed Out: This could be due to your instance’s security group settings. Make sure your EC2 security group allows inbound traffic on port 22 (the SSH port) from your IP address.

  • Authentication Failed: Ensure you’re using the correct username (ec2-user for Amazon Linux, ubuntu for Ubuntu).

Wrapping Up

And there you have it! Connecting to your EC2 instance using MobaXterm with your .pem keypair is as simple as following these steps. It’s not rocket science—but it kind of feels like it, doesn’t it? Now that you’ve got your EC2 instance up and running, the sky’s the limit.

So, go on, take what you've learned here, explore, experiment, and, most importantly, have fun with it! Until next time, happy cloud computing! ☁️

You can follow me on

Source: freecodecamp.org

Related stories
6 days ago - Welcome to my latest tutorial! After a three-year hiatus from certifications, I'm thrilled to announce that I've successfully obtained the AWS Certified Security Specialty certification. As someone who strongly believes in the power of...
2 weeks ago - Discover how this high-performance remote protocol securely streams graphics-intensive apps from cloud to device, with QUIC, client enhancements, and extended OS support.
5 days ago - Cloud hosting is a type of web hosting that hosts websites and applications on virtual servers provisioned across multiple geographic locations. It provides scalability, redundancy, dedicated resources, and superior control compared to...
2 weeks ago - Cloud GPU provider allows companies and businesses to utilize computational power on demand (via Cloud Graphical Units) without investing in high-performance computing infrastructure. Companies use cloud GPU providers to carry out...
1 month ago - Amazon Elastic Container Service (ECS) is a container orchestration service provided by Amazon Web Services (AWS). It is a solution developed by AWS to take care of the problem of managing large clusters of containers. Why Use ECS? There...
Other stories
52 minutes ago - From summarizing lengthy articles to providing detailed descriptions of images, AI models are becoming essential tools for developers. One such powerful tool is Claude, a state-of-the-art AI language model developed by Anthropic. Whether...
52 minutes ago - Earlier this year, I became really interested in learning about Astro, so I completely rebuilt my blog using it. The results have been amazing since then: I can easily handle automatic sitemap generation and SEO, and integrating other...
1 hour ago - Customer observation helps you understand their pain points, needs, user patterns, and in general what works for them versus what doesn't. The post What are the keys to customer observation? appeared first on LogRocket Blog.
1 hour ago - After almost 18 months of development, comprising thousands of commits from dozens of contributors, Svelte 5 is finally stable. It’s the most...
2 hours ago - Go behind the scenes of Monolith Studio’s bold website, created in collaboration with Artemii Lebedev, Okan Uckun, and Oscar Akermo, to discover how they brought a modern Brooklyn tattoo studio to life online.