How to run angular cli on ec2 instance ng serve not working

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 ""


Add On:

If you are getting this error with localhost:4200 you can try ng serve --host

To add specific port you can execute the command as follows: ng serve --host -- port 4200

Ucodice Technologies
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.


  • Sarat

    use ng serve --port 4202 --host --publicHost

    • Sarat
    • 4

Please share your views with us

Check if you want to display your email-id.