The best way to solve the error would be as to build everything from begining so that everything works fine. Building everything back I had to make sure to create EVERYTHING. This included:
- Create VPC
- Create Internet Gateway
- Attach Internet Gateway to VPC
- Create Routing Table
- Add Route to Routing Table
- Destination: 0.0.0.0/0
- Target: <Internet Gateway from earlier>
- Create Subnet
- CIDR: 10.0.0.0/24
- Routing Table: <Routing Table from earlier
You can follow the blog on Amazon VPC Tutorial to understand how you can build everything from scratch and properly.
https://www.edureka.co/blog/amazon-vpc-tutorial/
Hope it helps.