website down after installing ssl certificate through certbot in nginx

Below is my nginx configuration. I modified the 'default' file (which is placed at 'sites-available). I am able to access the website when it's through 'http'. But when I try through 'https', there is a connection time out and the page cannot be reached. Nginx is strangely not making any entries to the logs(both access.log and error.log). I am seeking for help since I am completely new to this.

# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.

##

# Default server configuration
#
server {
    listen 80;
    listen [::]:80;

    root /var/www/main.x.com/html;

    
    index index.html

    server_name main.x.com;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

}


server {
    listen 443 ssl;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_certificate /etc/letsencrypt/live/main.x.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/main.x.com/privkey.pem;

    server_name main.x.com;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    location / {
        root /var/www/main.x.com/html;
        index index.html;
    }
}

443 port opened in aws ec2

After two days of never ending debegging, I understood the problem. I had not opened 443 port in EC2 security group. Things to keep in mind whomever struggling with a similar issue -> Ensure that your OS firewall allows connections through 443 also ensure that your instance allows connections through 443.

enter image description here