Nov 142014
 
Article Server Administration

Amazon Web Services (AWS) hosting offers a great flexibility in the configuration of a computer platform, where each of the resources involved (CPU power, storage, bandwidth,etc.) can be independently configured.

Besides, the cost of the service is a function of the use of resources (pay as you go). Thus, a server is only charged for the hours that it has been active, and the cost of the storage depends on the number of I/O transactions performed.

These characteristics make AWS very different from the service offered by other hosting providers, where the user can choose among a limited set of server configurations, at a fixed monthly cost.

But this also means that the complexity involved in the configuration of the service is higher for AWS. A monitoring service is also required to be able to detect  and correct unexpected peaks in resource consumption, to avoid incurring in excessive costs.

Nevertheless, it is worth considering AWS as an alternative to more traditional VPS platforms, when it comes to setting up a platform for a web service that might need to be scaled as the use of the service grows.

This post is an overview of the main considerations and caveats that need to be taken into account in the setup of a platform on AWS.

1. Creating an account in AWS

The first step is to sign up to AWS. The signup form can be accessed from the AWS register page.

The first option in the signup form allows to choose the kind of support desired: “Developer” ($49/month) or “Business” (variable cost, more than $100/month). But it is also possible to choose the free “Basic” support by clicking on the “Create a Free Account” button at the bottom of the page.

Next, the register process continues through a series of screens where a name, an email address, a phone number and the credit card details are requested. Each of these data is verified by:

  • Sending a verification message to the email address, with a verification link that the user has to click.
  • A numerical code is displayed on the screen, and a phone call is made to the phone number entered, requesting to input the code
  • An authorization request for $1 (not charged) is issued to the credit card.

Once all those data have been verified, the user registration succeeds, and the  AWS console can be accessed, to start the configuration of the platform:

AWS-Console

At the right of the upper menu, we need to choose the location where the elements of the infrastructure are to be created. Depending on the location of the potential users, we may choose Europe (Frankfurt or Ireland), United States (East Coast, West Coast), South America (São Paulo) or Asia  (Tokio, Singapore or Sydney) as the preferred location of the platform.

2. Infrastructure components

A platform in AWS is made of a set of components (instances) of several types, combined to work together. The main components are:

2.1. EC2 (Elastic Compute Cloud)

A EC2 instance is the AWS equivalent to a traditional VPS. There are many different types of EC2 to choose from, differing mainly in the number of CPUs and the amount of main memory. They range from a t2.micro (1 CPU, 1 GB RAM, no local storage) up to a c3.8xlarge (32 CPU,  60 GB RAM,  2 x 320 GB SSD disk) or a i2.8xlarge (32 CPU,  244 GB RAM, 8 x 800 GB SSD disk).

The complete list of available types of EC2 servers can be found at Amazon EC2 Instances

2.2 EBS (Elastic Block Store)

A EBS volume is the AWS equivalent to a disk unit (or disk partition) in a traditional server.

There are several types of EBS volumes to choose from, depending on the technology (magnetic or SSD), and also on the number of guaranteeed I/O operations per second (General Purpose EBS / Provisioned IOPS EBS)

The complete list of available types of EBS volumes can be found at EBS Volume Types

2.3 RDS (Relational Database Service)

A database may be installed and configured on a EC2 instance. In that case, the user is reponsible for the maintenance of the database, and needs to act as a DBA.

But it is also possible to make use of a managed database service. RDS is the AWS service to access a fully managed database. With a RDS service, he administration, optimization, backup procedures, etc. are done by AWS. There are several types of RDS instances, depending on the processing power (number of CPUs and amount of RAM), and on the database management system chosen: MySQL, PosstgreSQL, Oracle or SQLServer

3. Configuring a basic, general purpose server

3.1 Choosing the operating system

The creation of a new EC2 instance starts by choosing one from the set of existing Amazon Machine Images (AMI), that defines the operating system that the  instance will run.

There are different types of AMIs, depending on the operating system (Linux, Windows), the architecture (32 or 64 bit) and the virtualization type (paravirtual or hvm)

AWS-EC2-choose-AMI

3.2 Choosing the EC2 instance type

The next step is choosing the desired type of server (instance), as a function of the number of CPUs and main memory requirements. The network performance is also related to the instance type chosen, and goes from “Low to Moderate” for the most basic types, up to 10 Gigabit connections.

AWS-EC2-choose-instance

Indeed, the cost is also a main factor in choosing a server type. Due to the complexity of the billing model in AWS, it a good idea to use the AW simple monthly calculator to estimate the monthly spend that might be billed.

AWS-EC2-instance-cost

As we can see in the screenshot above, there are billing options other than the plain pay-as-you-go. In cases such as the hosting of a web server, where the desired availability is 24×7, a considerable reduction on the monthly cost can be achieved choosing a “Heavy” compromise for one of three years. Using the calculator, we have obtained an estimate of the effective monthly cost for several cases:

  • t1.micro –  €8.83
  • t2.micro –  €8.83
  • t2.small –  €12.90
  • t2.medium – €25.79
  • m3.medium – €39.00
  • m3.large – €78.65

3.3 Configuring the instance details

The next step in the configuration process displays a form where connectivity, security and other details of the instance can be selected:

AWS-EC2-instance-cfg

For a simple platform of only one EC2 instance, the default values are usually acceptable.

For more complex cases, where several EC2 instances are involved, it may be necessary to create a new VPC (a kind of intranet) to interconnect them.

Another important decision is whether the instance can be run on hardware shared with other users (“Shared tenancy”) or on dedicated hardware, at a higher cost.

3.4 Adding disk space

Low-end EC2 instances do not include local storage. Therefore, adding at least a EBS volume for the installation of the operating system is required.

Middle- and high-end instances have local storage included in the basic configuration. However, depending on the storage requirements of the applications to be run, it might also be necessary to add additionals disk space to their configuration.

AWS-EC2-instance-storage

There are several types of storage to choose from

  • Magnetic disk
  • General purpose SSD disk
  • SSD disk with guaranteed number of I/O operations per second (Provisioned IOPS)

3.5 Adding tags to the instance

A tag is a pair (name, value) that can be optionally attached to the instance for reference.

3.6 Creatng a security group

A security group is the equivalent in AWS to a set of firewall rules, where the accesses allowed from different origins to different ranges of IP addresses and ports are specified.

In order to configure a publicly accessible web server at least a rule to allow access from anywhere to HTTP port 80 needs to be added to the security group.

AWS-EC2-sec-group

Other rules may be required to allow access to other services: MYSQL, SMTP, etc. running on the server.

3.7 Generating a public-private key pair

After the configuration of the instance is complete, and before it is launched, AWS requests a key pair that will be used to login securely to the instance:

create-key-pair

 

If this is the first EC2 instance, no key pairs exist yet. In this case, select “Create new key pair” in the dropdown at the top, and enter a name (for instance, “myawskey”).

AWS-create-key-pair

A file “myawskey.pem” is generated and downloaded. After download, make sure to change the file permissions to be readable only by the owner:

3.8 Connecting to the server with ssh

The EC2 instance starts running once the initial configuration is complete and a key pair has been chosen or a new key pair has been generated. The details of the configuration can then be displayed in  the EC2 administration panel:

AWS-EC2-connect

 

The public IP address and public DNS name assigned to the instance can be found in the “Description” tab. With this information, and using the “.pem” key pair previously generated, a first SSH connection to the server can be established:

4. Configuring a database service

It might be the case where the application that will be running on the AWS platform being configured requires a database. As the user has root access to the EC2 instance, it is possible to install and configure a local DBMS (MySQL, PostgreSQL, …) to be used by te application.

But if the user doesn’t want to act as a DBA, AWS also offers a fully managed database service, known as RDS.

To create a RDS instance

  • Got to the administration panel and select Services > Database > RDS. Then, click on the button “Launch a DB Instance”.
  • In the next screen, select the desired type of database: MySQL, PostgreSQL, Oracle o SQLServer
  • The next screen gives the option to use “Multi-AZ Deployment” and “Provisioned IOPS Storage”.
    Option “Multi-AZ” guarantees a high availability of the service, by creating a hotcopy database that is automatically activated if the production database becomes inactive for any reason (planned maintenance, unplanned outage). The drawback is that this option doubles the cost of the service.
    The option “Provisioned IOPS Storage”, can be used to configure a minimum guaranteed number of I/O operations per second. The cost is relatively small for load levels not too high. But, if this option is selected, the minimum amount of storage than can be configured is 100 GB.
  • The next screen is a form where additional details of the RDS server can be specified: Server type and version, disk size, etc.:AWS-RDS-detailsAt the bottom of the form the name of the database instance and the name and password of the administrator user are requested:
    AWS-RDS-details-2
  • Finally, the Advanced Configuration form is displayed. The connectivity of the database instance is configured in this form:
    AWS-RDS-adv-settings

One of the most relevant options in this form is “Publicly Accessible”. If “Publicly Accessible is set to “Yes”, a public IP address will be assigned to the RDS server, and the database will be accesible from internet (provided that the VPC security group chosen allows access to the database port). If “Publicly Accessible” is set to “No”, only EC2 instances connected to the same VPC (i.e., the same intranet) will have access to the database.

After the configuration of the RDS instance is complete and the instance has been launched, the RDS administration panel shows the details of the newly created instance:

AWS-RDS-instance-data

In this screen, all the configuration options chosen can be reviewed. I also shows the Endpoint assigned. This is the DNS name and port that can be used to connect to the database.:

5. Creating Billing Alerts

In AWS, it is not (yet) possible to configure a limit to the daily or monthly spend. Instead, it is possible to create alerts that are triggered when a given spend threshold is reached.

To do this, go to the AWS Billing and Cost Management Console. In the navigation panel, select  Preferences. Mark the Receive Billing Alerts checkbox, and click on the button Save preferences.

Then, click on the link Manage Billing Alerts to go to the CloudWatch console. In the top menu, select the US East (Northern Virginia), region (even though the services we have created might be on a different region).

In the left menu, select Metrics > Billing.

Select the metric EstimatedCharges:

AWS-BIlling-Metrics

 

Then, in the left menu, select Alarms > Billing, and click on the button Create Alarm. Replace the default name “NotifyMe” with a new name for the distribution list to be created, and enter one or several email addresses that will receive the alerts. Each of those email address will receive a message with a confirmation link that must be clicked.

Finally, select again Alarms > Billing to verify that the new alert appears in the list of existing alerts:

AWS-Billing-Alarm

References

AWS Documentation: Create a Billing Alarm to Notify You If Your Usage Exceeds the Free Tier

 Posted by at 5:54 pm

 Leave a Reply

(required)

(required)