How to Open Port in Amazon EC2 instance

By default Amazon EC2 only allow port 22 (SSH) on Linux servers and port 3389 (RDP) on Windows Instances. All other ports are closed for security reasons. Depending on your use case, you may need to open ports on the security group to allow connection to applications you run on the EC2 instance.

Log in to the Amazon EC2 console.

In the navigation pane, click instances. This will list all available Amazon EC2 instances. Find the instance ID of the EC2 instance where you need to open the port.

Advertisement

AWS EC2 instance ID

Click on the Instance ID to find more details about the Amazon EC2 server.

AWS EC2 Security Group

On the AWS EC2 Instance details page, click on the “Security” tab. Below you will see “security groups”. A security group is like a firewall, you can allow/disallow incoming and outgoing ports here. Click on the Security Group ID to go to the security group page.

Amazon EC2 security group details

Click on the “Edit inbound rules” button. You can add or remove rules on the “Edit inbound rules” page.

Open Port in AWS

To Ope a port, click on “Add rule” button.

how to add inbound rules in aws ec2

To open a port, you need to add a rule for the port by clicking “Add rule” button.

You will get a new entry, where you need to select your rule.

Type = This is a drop-down select box with the default value “Custom TCP”. You can find many predefined rules for common services like HTTP, HTTPS, MySQL, etc.. You can use Custom TCP or Custom UDP, then enter the port number you need to open.

Port range = You can enter the port number to open on this text box.

Source = This is IP add where you are allowed to connect. To allow all connections, use 0.0.0.0/0

Description – optional = you can enter a note so you know what this port is used for.

Once you added this, click on the “Save rule” button to save the rule. It will configure the security group to allow the port you added.

aws ec2 open port 8080

This screenshot shows the rules needed to Open Port 8080 on the AWS security group for Anyone.

Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement