Review the security group inbound and outbound traffic.
If your computer is on a corporate network or if you are connecting through an internet service provider (ISP). Instead, specify the range of IP addresses used by client computers.
If your security group does not have a rule that allows inbound traffic add a rule to your security group.
Here's a reference link to
security group rule
document
Below are steps to connect Amazon EC2 Instance from Ubuntu terminal
-Open terminal and Navigate to the location where you have saved your .pem
key pair file.
-Secure your Key pair file.
sudo chmod 400 abc.pem
-Connect to your instance using IP address.
ssh -i abc.pem ubuntu@IP-address