AWS

How to Open Port in AWS EC2

To connect to your instance from outside the AWS, you must give access by opening that port. For instance, if you want to allow HTTPS services to be available on your EC2, then this means that you will have to open up port number 443. After that, you will have to give open access to all “IP addresses” to access your instance using the port you have just opened. To open an AWS port, you must make configuration changes from your security groups.

Opening Ports in AWS EC2

We have different known port types and their number, which serve a specific purpose. We can use any port in AWS from the given list (in the image below) and many more. In this post, we will open an “HTTPS” port in AWS EC2 which has port number 443.

As mentioned above, to open ports, we need to change the configurations of the security groups. So let’s start with that.

Step 1: Editing Security Groups

To start, we have to enter the “security group” page. For that, we need to click on the “Instance ID”, it will take us to the instance information page.

From this page, we need to select the “Security” button. From here, we can access the security group for the EC2 instance:

This page provides us with the link to the security group, and we have to click on that link to start our configuration:

Step 2: Change Inbound Rules

From this page, we can start configuring the rules using the “Edit inbound rules” button. It will allow us to edit the rules which prevent us from using some ports.

On the inbound rules page:

  • First, you need to click on “Add rule”, and it will add a new rule bar in which you can allow different ports.
  • You can even use different ports by searching for their service, as shown in the screen below.
  • To add the ports for HTTPS, Select ”HTTPS” from the search bar’s drop-down menu or manually add port number 443. After that, set the source for traffic according to your requirements. For this post, we are going with the source “Anywhere”. It means you can use this port from all over the world.

You must save the changes to implement them, and for that, you simply have to click on the “Save rules” button.

Step 3: Verification

After you have saved all the changes made to inbound rules, you will be directed to the security groups page. From this page, you can verify that the new rule has been applied. As you can see in the output, we have successfully opened port number “443” for access.

You have successfully opened an “HTTPS” port (443) in AWS EC2.

Conclusion

To open a port in AWS EC2, you need to change the configurations in the security group of the EC2 instance. These changes will be done inside the inbound rules of the security groups. In there, you can add different rules for whatever port you want to give access to. With the configuration of these inbound rules, you can not only open ports but also select the inbound traffic that is allowed to use the newly opened port.

About the author

Abdul Mannan

I am curious about technology and writing and exploring it is my passion. I am interested in learning new skills and improving my knowledge and I hold a bachelor's degree in computer science.