How to Open SSH Port in EC2?


How to Open SSH Port in EC2?

Amazon Elastic Compute Cloud (EC2) is a powerful and scalable cloud computing service, allowing users to launch virtual servers, known as instances, in the cloud. Securing your EC2 instances is crucial, and one common task is opening the SSH port to enable secure remote access. In this guide, we will walk you through the process of opening the SSH port on your EC2 instance, ensuring a seamless and secure connection.

Step 1: Accessing the AWS Management Console

To begin, log in to your AWS Management Console and navigate to the EC2 Dashboard. Here, you'll find a list of your instances.

Step 2: Selecting Your EC2 Instance

Identify the EC2 instance for which you want to open the SSH port. Click on the instance to select it.

Step 3: Modifying Security Groups

In the instance details section, scroll down to the "Security Groups" tab. Security groups act as virtual firewalls, controlling inbound and outbound traffic to your instances.

Step 4: Reviewing Existing Security Groups

Take note of the security groups associated with your instance. To open the SSH port, we'll need to modify the rules of the relevant security group.

Step 5: Modifying Inbound Rules

Click on the security group associated with your instance. In the "Inbound" tab, you'll see a list of rules. Locate the rule for SSH (Port 22).

Step 6: Adding a New Rule

To open the SSH port, click "Edit Inbound Rules." Add a new rule for SSH, specifying the source IP address or range that should be allowed to connect. If you want to allow connections from any IP, use "0.0.0.0/0" (not recommended for production).

Example:

  • Type: SSH
  • Protocol: TCP
  • Port Range: 22
  • Source: Your IP address or 0.0.0.0/0 for any IP

Step 7: Saving Changes

After adding the rule, save the changes. The security group is now configured to allow SSH connections to your EC2 instance.

Step 8: Connecting via SSH

Use your preferred SSH client to connect to your EC2 instance. If you're using the command line, the syntax is as follows:

ssh -i your-key.pem ec2-user@your-instance-ip

Replace "your-key.pem" with the path to your private key file and "your-instance-ip" with the public IP address of your EC2 instance.

Congratulations! You have successfully opened the SSH port on your EC2 instance, allowing secure remote access.

Related Searches and Questions asked:

  • How to Connect to EC2 with SSH PuTTY?
  • How to Open SSH Port in EC2 for Secure Remote Access
  • How to Connect SSH to PuTTY from AWS?
  • How to Connect to AWS EC2 Using SSH?
  • That's it for this topic, Hope this article is useful. Thanks for Visiting us.