AWS – the Amazon cloud

Egmont-Petersen

Background

Amazon started as company with an online bookstore. Good old fashioned paper editions were offered for sale via the Amazon webportal. Behind the curtains, Amazon organized the logististics such that different publishers could supply the purchased books as fast as possible.

It turned out that booksales fluctuate much over the year in the US and in Europe. The month before Christmas is traditionally very busy. Amazon had to develop their webstore as to acommodate these large fluctuations of customer visits, over time. Over time, Amazon realised that they had developed a highly efficient web-architecture, which could be offered as a general cloud platform to third party customers. So Amazon went on to develop an easy-to-get-started-with cloud platform for commercial purposes. This platform is today known as Amazon Web Services, or AWS.

AWS – Getting Started

First, you need to determine whether AWS is the cloud solution you need. If for example you are a Microsoft enthousiast developing webservices primarily in .NET, the Microsoft cloud Azure will be the preferred option. AWS, on the other hand, is really cool for Java-developers with Linux experience. Although most configuration of AWS takes place via clickable web-forms, you need to master Linux/Unix commands at a certain level to be able to configure an AWS server correctly. I had to upgrade the native Java-installation from 1.7 to version 1.8, for example, in order to be able to run my Java-Spring Webservices.

It should be kept in mind that AWS can also run hosted Windows computers. On the other hand, Azure also allows you to deploy Java applications in a Unix instance, the latter option is described in the web-tutorial run Java under Azure.

 

Getting started – your first AWS-node

You need to register yourself with AWS, using a valid email-address.

Via the link: create account

 (click on the upper-right button in orange color).

You register with AWS as customer/user.

 

AWS provided you with a set of options. I chose a Linux image, for my EC2-instance.

 

What’s on the AWS EC2 instance ?

When newly built, the AWS EC2 instance is a bare Linux computer. Depending on the requested configuration (# CPUs, etc.), more computing power is available at your disposal. So you login and get a unix-prompt. I continue with an Ubuntu installation.

You need to know the installation commands from Ubuntu:

sudo apt-get install <your application to install>

 

Where are applications located, initially, on your EC2 Lnix machine? Tomcat7 is located in:

/usr/share/tomcat7

 

/var/lib/pgsql9

So on my EC2-instance, both Tomcat and Postgres are unix-services. To start my local postgres, you do:

sudo service postgresql start

 

When working with more than one EC2-instance behind an AWS load-balancer, you will typically locate your relational database on a different EC2-node.

The different EC2-instances running your applications can connect to the data-service instance which hosts the relational database.

 

Run tomcat with https – AWS

When web-applications exchange sensitive information with a user (your user-id, your password, some personal information, financial data, etc.), you need to go into secure web-mode, which is called https. Https-mode is shown in your browser-address, beginning with: https://mywebsite.com.

 

Your tomcat-installation requires a security-certificate, which you need to purchase, separately.

First modify the file: conf / server.xml, in the Tomcat-installation:

...
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"

maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
...

 

Per default, Tomcat expects the purchased certificate file, .keystore, to be located in the directory:

/usr/share/tomcat7

Stop and start the tomcat service, and you will be able to run https web applications.

 

AWS Security

See AWS security groups

 

AWS Load balancing

Three different elastic load balancing approaches are available within AWS:

  • Application Load Balancer. Optimizes for http-requests.
  • Network Load Balancer. Specifically for TCP-requests.
  • Classic Load Balancer. General load balancing between EC2-AWS instances.

 

Before disucssing these different approaches, the purpose of load balancing is explained.

Load Balancing automatically distributes incoming application traffic across multiple virtual computers, that is, Amazon EC2 instances. The more requests occur on a website, the higher the traffic load and hence CPU-load as well as used memory. Load balancing was invented to make possible adding computer resources to handle an increasing number of requests. 

The Application Load Balancer has by far the most options to offer to the cloud managers: 

https://aws.amazon.com/elasticloadbalancing/features/#Details_for_Elastic_Load_Balancing_Products

Another advantage of Load Balanced Services is that application upgrades can be performed while the application server is still available to http-visitors, that is, everyone can still approach one of the web-instances. A minimal configuration is one with a load balancer and two instances. One instance is shut down for upgrade, while the other instance keeps running. After the upgrade, the instance is again put into service, and becomes available to the http-users. Next, the second instance is being shut down for maintenance. The only disadvance for the website visitors is that temporarily slower web-sessions appear, during such upgrade operations.

 

AWS basic node setup

The picture below illustrates two basic design configurations within the AWS-cloud.

 

 

The left setup is the most simple one you can configure in AWS. It consists of one single virtual computer (one EC2-node), and the cloud engineer solely has to select the number of CPUs, the amount of memory, and the other standard AWS-configuration options such as the security groups.

The right setup consists of a load-balancer, two EC2-nodes, and a separate database instance (a separate virtual machine). The two EC2-instances A and B share the relational database.

 

Tutorial – setup classic load-balancer in AWS

 

AWS Lambda

A newer feature of AWS is the provision of Lambda’s, server-less computing services that run an application or just a script of your choice. So the server administration is organized for you, within the Lambda framework. Another major difference with EC2-instances is that the customer pays per execution time unit, rather than per node. So if you have much downtime, or your services is not used a lot, it can be cost-effective to run Lambda-services. 

 

AWS Machine learning

AWS contains a whole suite for performing machine learning – Amazon EMR. It enables you to assemble your data, perform data preprocessing, and learn machine learning models. Amazon Machine learning also contains Deep Learning. This more recent neural network technology has applications within image processing where a spatially hierarchical structuring of the successive layers merge, and reduce the raw image data into recognitions.

See: AWS courses (search for topic Machine Learning)