Solution for error
Provided host xx.xx.xx.xx could NOT be bound. Please provide a different host address or hostname
If you run ng serve without giving correct port & correct public DNS you may get above error.
For any new developer hosting Angular application on AWS EC2 instance can be confusing some time. Running ng serve starts the server but still your applicatoin is not running.
You need to check few thins in your EC2 instance
1. First check that port 4200 or any port that you want to use for Angular is added in security group to accept the traffic.
2. After allowing the port run ng serve with correct domain name or Public DNS shown in EC2 Instance for example "ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com"
If you are getting this error with localhost:4200 you can try ng serve --host 0.0.0.0
To add specific port you can execute the command as follows: ng serve --host 0.0.0.0 -- port 4200
Let's work together
or write to us at