I am inexperienced in cloud. I have created a compute instance in Oracle Cloud. But when I try to ssh to it using the public i/p, it says 'cannot connect to host port 22: operation timed out'. I have created a public i/p for the instance and provided the public key. All the other options are set to default. Can anyone please help?
You need to check if you have an Internet Gateway and Route Table with the right rule deployed within your VCN and also check if you have opened the TCP 22 port in the Security List assigned to your subnet (or you have to create a Network Security Group assigned to the VNIC). You can find the details in this guide. If everything is set and you are still unable to ssh, you might have a firewall within your instance. You can check it with either firewall-cmd or iptables depending on your linux.