Issues Running Angular with Cloud9 on aws


#1

Im trying to get the basic angular app up and running on AWS using cloud 9.
Ive run through the setup suggested here
https ://community.c9.io/t/anyone-using-c9-to-do-the-angular2-project/7078/12?u=developeralex
along with using the newest versions of things.

When I try to start the server I use
ng serve --host 0.0.0.0 –port 8080 –live-reload-port 8081 –public-host http://ec2-xxx-xxx-xxx-xxx.us-east-2.compute.amazonaws.com
I see this in the terminal
** NG Live Development Server is listening on 0.0.0.0:8080, open your browser on http://localhost:8080/ **
Date: 2018-01-03T18:28:58.415Z
Hash: 43ba61e9120cef67c91e
Time: 8981ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 19.5 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 557 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 33.8 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 7.16 MB [initial] [rendered]

webpack: Compiled successfully.

When I try preview running application it shows "invalid host header"
Any ideas what I might be doing wrong?
TIA


#2

I was able to get this to work by editing the security group on the EC2 instance.
I added a custom TCP rule with port 8080 to the inbound security rule.
Then run ng serve --host 0.0.0.0 –port 8080
This allows me to open the app in a browser using EC2-IP:8080


#3

One of the issues I had with AWS development was the confusing security rules. There was little documentation and zero support unless you paid a fee. I am still able to run apps on Cloud 9 without this. At least the last I checked. I don’t have an AWS account as I closed the free tier because I started to get real charges on my credit card.