I m created an EC2 instance with default subnet and VPC.
I m also added inbound and outbound rules(with port 22 is allowed from anywhere and outbound traffic can go anywhere) to it.
An Internet gateway also attached to the VPC and the route is defined as 0.0.0.0/0.
but I m getting the following error when tried to ssh it from my ubuntu machine
ssh: connect to host ec2-13-233-87-56.ap-south-1.compute.amazonaws.com port 22: Connection timed out
but I can able to ssh my other local machine from my ubuntu machine
ec2-13-233-87-56.ap-south-1.compute.amazonaws.com
works. I don't know what you are testing. Maybe wrong address. What you posted works as expected. – Marcin