Amazon EC2 403 Forbidden error message

10,852

On AWS-EC2, whenever you associate an Elastic IP with an instance, both the Public IP and AWS Public DNS are updated to reflect the Elastic IP. From my experience, this usually happens in less than a minute, but that can vary.

As for why you can't connect to the instance from either a browser or from a SSH (Putty) connection. If you could answer these questions I can probably help you sort out why you can't connect to your instance.

For the 403 Error-

  1. Are you using Apache? If yes, have you updated the vhost entries in the http.conf, ssl.conf and any other relevant apache configuration files? You need to update any vhost blocks that refer to the old AWS Public IP or AWS Public DNS to reflect the change to the new Elastic IP. You can set the vhost ServerName to any of the following- Elastic IP, AWS Public DNS or FQDN (Fully Qualified Domain Name). After you update the conf files don't forget to Restart Apache.
  2. Is the instance associated with a Security Group that has Ports 80 & 443 (Default HTTP & HTTPS) open? Obviously, if you changed the ports you are serving your site on, those port numbers would need to be open in the Security Group instead of 80 & 443.

For Putty Connection-

  1. Can you post the ssh command you are using from Putty?
  2. Is the instance associated with a Security Group that has Port 22 (Default SSH Port) open?
Share:
10,852
Admin
Author by

Admin

Updated on June 14, 2022

Comments

  • Admin
    Admin almost 2 years

    I have assigned the Elastic IP to my EC2 instance and after that when I went to access the instance it gives me the 403 Forbidden error message and the IP has also been changed. Also I am not able to acess it using Putty.

    Any help would be appreciated.