You have to edit the Security Group to which your EC2 instance belongs and allow access (or alternatively create a new one and add the instance to it).
By default everything is denied. The exception you need to add to the Security Group depends on the service you need to make available to the internet.
If it is a webserver you will need to allow access to port 80 for 0.0.0.0/0 (which means any IP address).
To allow pinging the instance you need to enable ICMP traffic.
The AWS Web Console provides some of the most commonly used options in the relevant dropdown list.
Get ready to level up your skills as an AWS Developer! Join our comprehensive AWS Developer Associate certification Course!