Spinning up a server in the cloud is the most common task cloud architects perform, and it's a cornerstone for...
constructing a cloud-based IT infrastructure.
While spinning up a free tier EC2 instance using the AWS Management Console is straightforward, configuring the cloud requires a few more steps. Let's take a look at the steps needed to access your server as well as an overview of configuration commands for publishing a website.
Create access to a virtual instance
Creating access to a virtual instance can be done across any platform using client software or through a Web browser running Java. To connect using a Java SSH Client, select the instance from the EC2 dashboard and click Connect, as shown in Figure 1.
In the Connect to Instance dialog, select the Java SSH Client connection option and enter the path to the private key file created from the EC2 instance setup phase. This gives you access to credentials you can use to connect (Figure 2).
To connect using client software such as PuTTY, select A standalone SSH client radio button and click the AWS link connect using PuTTY for access instructions (Figure 3).
Configure the Linux AMI
To configure the Linux Amazon Machine Image (AMI) instance to launch a new website on AWS, the following steps set the stage:
1. After SSH-ing into the instance, enter the following commands to complete instance configuration:
1. yes | sudo yum update -- This command updates the operating system
2. yes | sudo yum install httpd -- This command installs the Apache Web Server
3. yes | sudo yum install emacs -- This command installs the emacs editor
4. sudo service start httpd -- This command starts the Apache Web Server
2. Change directory to the Apache document root folder and create the first webpage
1. cd /var/www/html
2. emacs index.html
3. In the emacs editor, enter some sample HTML code such as <h1>Hello World</h1>, save and exit emacs
To check that everything works, copy the public DNS in the EC2 dashboard and paste it into a Web browser. Your "Hello World" website is now live. Eventually you will want to move your Web files to /var/www/html.
The public DNS entry listed in the EC2 dashboard is the URL address of your website, but nobody will remember that long address. Create an elastic IP address and associate it to your EC2 instance. This will be a persistent IP address that always points to your website. For example, if you terminate your instance or if you scale up your instance size to meet increased traffic, you can associate the elastic IP to the new instance. The IP address to your website never needs to change.
Finally, to point your website domain name to your new website, assign the A record of the domain to the elastic IP address in your domain name registry of choice. Access your domain name registrar and point the DNS "A Record" of the domain name that will host these EC2 instance Web files to the elastic IP address you saved earlier. Your site will be live once top-level domain name servers are updated.
About the author:
Russ Vanderpool, MSCS and MBA, is a technologist interested in using cloud technology to deliver solutions, help companies better serve customers and to identify new businesses. He has hands-on experience as an architect/developer and a business adviser across the finance, energy, education, technology and nonprofit sectors. Russ has architected and built a cloud infrastructure for a green tech company, and while working for Japan's largest system's integration firm, he developed proprietary object-oriented database visualization software for that market.