Reputation: 8168
Is it possible to use Amazon ECS to host a web page? I tried going to my page http://ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com/ and nothing comes up.
My boss has given me a username and SSH key. I'm not sure where I could put the index.html so it could show up on the web?
Upvotes: 0
Views: 241
Reputation: 8533
If the site is static you can more simply host it on S3 and forego any EC2 instances.
Upvotes: 0
Reputation: 101
Sure. I host my site on an ec2 micro instance that I also use for other things.
Your EC2 instance is just a Linux (or Windows) virtual machine. If you want to serve pages, then you'd need to install a web server. For example on Linux you can install apache, nginx, or similar. On Windows you could also install IIS. You'll also want to put the pages you want to serve on the server in your DocRoot and be sure that you've opened up port 80 (also 443 if doing ssl) to the outside world.
You didn't mention which AMI you are running, so I'll assume the Amazon Linux AMI, which is perhaps the most basic and commonly used in examples. On the Amazon Linux AMI, which is a Fedora/RedHat derivitive, you can install apache like this
sudo yum install httpd
And the pages then go in /var/www/html
.
You can open the port via the command line or the aws console. The console is probably easier. Assuming your security group was called default
opening port 80 from the command line is just
ec2-authorize default -p 80
Out of the box, there's no reason to expect there to be a web server, unless of course you launched an AMI that had one preconfigured, and there are plenty of them. AMI range from raw OS images to complete application stacks as appliances.
Upvotes: 2