Book Image

Amazon Web Services: Migrating your .NET Enterprise Application

By : Rob Linton
Book Image

Amazon Web Services: Migrating your .NET Enterprise Application

By: Rob Linton

Overview of this book

Amazon Web Services is an Infrastructure as a Service (IaaS) platform in the Cloud, which businesses can take advantage of as their needs demand. The Amazon Cloud provides the enterprise with the flexibility to choose whichever solution is required to solve specific problems, ultimately reducing costs by only paying for what you use. While enterprises understand moving their applications among infrastructure they own and manage, the differences in Amazon's infrastructure bring up specific business, legal, technical, and regulatory issues to get to grips with. This step-by-step guide to moving your Enterprise .NET application to Amazon covers not only the concept, technical design, and strategy, but also enlightens readers about the business strategy and in-depth implementation details involved in moving an application to Amazon. You'll discover how to map your requirements against the Amazon Cloud, as well as secure and enhance your application with AWS. This book helps readers achieve their goal of migrating a .NET Enterprise Application to the AWS cloud. It guides you through the process one step at a time with a sample enterprise application migration. After comparing the existing application with the newly migrated version, it then moves on to explain how to make the hosted application better. It covers how to leverage some of the scalability and redundancy built into the Cloud, and along the way you'll learn about all of the major AWS products like EC2, S3, and EBS.
Table of Contents (19 chapters)
Amazon Web Services: Migrating your .NET Enterprise Application
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

AWS products covered in this book


Here is a summary of the products covered in this book. Please note that this summary does not encompass all AWS products.

Amazon Elastic Compute Cloud (EC2)

EC2 provides virtual computing resources on demand, in effect allowing virtual servers to be spun up and down on demand in the AWS cloud.

Command-line tools

The command-line tools are provided by the Amazon staff and are located at:

http://aws.amazon.com/developertools/351

Environment variables used

These are the environment variables used when setting up command-line tools:

set JAVA_HOME="C:\Program Files\Java\jre6"
set EC2_PRIVATE_KEY=c:\aws\pk-XUSF3YX32DTZWSBHEIENR24EANXCXUBA.pem
set EC2_CERT=c:\aws\cert-XUSF3YX32DTZWSBHEIENR24EANXCXUBA.pem
set EC2_HOME=C:\AWS\ec2-api-tools\ec2-api-tools-1.3-62308
set PATH=%PATH%;C:\AWS\ec2-api-tools\ec2-api-tools-1.3-62308\bin
Commands used in the book:

These are the commands used in this book:

Command

Description

Chapter

ec2-describe-regions
  
  

List all of the current regions available

Chapter 3, Getting Started with AWS and Amazon EC2

ec2-describe-images –o self

List all of the AMIs owned by the AWS user

Chapter 3, Getting Started with AWS and Amazon EC2

ec2-run-instances ami-70b24319 -g migrate_to_aws_secure -k migrate_to_aws_key_pair --availability-zone us-east-1a –monitor

Start up an EC2 instance using AMI ami-70b24319 in the migrate_to_aws security group using the migrate_to_aws_key_pair key pair in the us-east-1a availability zone

Chapter 3, Getting Started with AWS and Amazon EC2

ec2-create-tags i-cc9b92a1 --tag "Name=DB01"

Associate a tag with a running instance

Chapter 3, Getting Started with AWS and Amazon EC2

ec2-describe-instances --filter "instance-state-name=running"

Get a list of running instances

Chapter 3, Getting Started with AWS and Amazon EC2

ec2-terminate-instances i-cc9b92a1

Terminate a running instance

Chapter 3, Getting Started with AWS and Amazon EC2

ec2-stop-instances i-cc9b92a1

Stop a running instance

Chapter 3, Getting Started with AWS and Amazon EC2

The following figure shows the AWS console location for EC2:

Summary of instance types and costs

The following is a summary of the costs and types of instances:

Name

Description

Approximate cost/year

(on demand Windows, not including storage, network or other AWS costs, costs are for comparison only and are in $US)

Standard – Small

1.7 GB RAM, 1 EC2 compute unit, 32 bit, 160 GB local storage

$1,051

Standard – Large

7.5 GB RAM, 4 EC2 compute units, 64 bit, 850 GB local storage

$4,204

Standard - Extra Large

15 GB RAM, 8 EC2 compute units, 64 bit, 1690 GB local storage

$8,409

Micro

613 MB RAM, variable EC2 compute units to a max of 2, 64 bit

$262

High Memory - Extra Large

17.1 GB RAM, 6.5 EC2 compute units, 64 bit, 420 GB local storage

$5,431

High Memory - Double Extra Large

32.4 GB RAM, 13 EC2 compute units, 850 GB local storage, 64 bit

$10,862

High Memory - Quadruple Extra Large

68.4 GB RAM, 26 EC2 compute units, 1690 GB local storage, 64 bit

$21,724

High CPU - Medium Instance

1.7 GB RAM, 5 EC2 compute units, 350Gb local storage, 16 bit

$2,540

High CPU - Extra Large

7 GB RAM, 20 EC2 compute units, 64 bit, 1690 GB local storage

$10,161

Amazon Simple Storage Service (S3)

S3 is an object store for storing files on the cloud in AWS. Files of up to five terabytes may be stored.

Command-line tools

S3 tools on Codeplex provided by third party.

Alternative tools provided at s3tools.org are located at:

http://s3.codeplex.com

To set up this tool use the following command:

s3 auth <Access Key> <Secret Access Key>
Commands used in the book

The following are the commands used throughout this book.

Command

Description

Chapter

s3 auth AKIAIIJXIP5XC6NW3KTQ 9UpktBlqDroY5C4Q7OnlF1pNX tK332TslYFsWy9R

Set up credentials

Chapter 4, How Storage Works on Amazon

s3 list

List S3 buckets

Chapter 4, How Storage Works on Amazon

s3 put migrate_to_aws_02 myfile.txt

Upload a file to S3

Chapter 4, How Storage Works on Amazon

s3 put migrate_to_aws_02/mybigfile/ mybigfile.txt /big

Upload in chunks a large file to S3

Chapter 4, How Storage Works on Amazon

s3 get migrate_to_aws_02/myfile.txt

Download a file from S3

Chapter 4, How Storage Works on Amazon

s3 get migrate_to_aws_02/mybigfile/mybigfile.txt /big

Download in chunks a big file from S3

Chapter 4, How Storage Works on Amazon

The following screenshot shows the AWS console location for S3:

Approximate costs

Storage for S3 costs approximately as follows:

For one (1) terabyte of storage for one year = $1,720

Amazon Elastic Block Store (EBS)

EBS provides raw disk to EC2 instances on AWS.

Command-line tools

Command-line tools are provided by the EC2 command-line tools package.

Commands used in the book:

These are the commands used throughout the book for EBS:

Command

Description

Chapter

ec2-create-volume  --size 20 --availability-zone us-east-1a

Creates an EBS volume

Chapter 4, How Storage Works on Amazon

ec2-attach-volume vol-b418c2dc -i i-e2fdea8f -d xvdg

Attach an EBS volume

Chapter 4, How Storage Works on Amazon

ec2-detach-volume vol-b418c2dc

Detach an EBS volume

Chapter 4, How Storage Works on Amazon

ec2-delete-volume vol-b418c2dc

Delete an EBS volume

Chapter 4, How Storage Works on Amazon

Available EBS Devices

Windows: xvdf through to xvdp

Unix: /dev/sdf through to /dev/sdp

The following screenshot shows the AWS console location for EBS:

Approximate costs

Storage for EBS costs approximately as follows:

For one (1) terabyte of storage for one year = $1,228

Amazon Autoscaling

Amazon autoscaling provides for the dynamic creation of EC2 instances based on server demand.

Command-line tools

Autoscaling command-line tools are provided by Amazon staff.

The Autoscaling tools are located at:

http://aws.amazon.com/developertools/2535

The environment variables used for the autoscaling tools are:

set AWS_AUTO_SCALING_HOME=C:\AWS\AutoScaling-1.0.33.1
set PATH=C:\AWS\AutoScaling-1.0.33.1\bin;%PATH%
Commands used in the book:

These are the Autoscaling commands used throughout this book:

Command

Description

Chapter

as-describe-launch-configs

Describe launch configuration information

Chapter 9, Monitoring and Scaling My Application

as-create-launch-config WebLaunchConfig --image-id ami-7cb54915 --instance-type m1.large –group "Web Servers"

Create the autoscaling launch configuration

Chapter 9, Monitoring and Scaling My Application

as-create-auto-scaling-group WebAutoScaleGroup --launch-configuration WebLaunchConfig --availability-zones us-east-1a --min-size 2 --max-size 4 –load-balancers my-load-balancer

Create the autoscaling group

Chapter 9, Monitoring and Scaling My Application

as-put-scaling-policy WebScaleUp --type ChangeInCapacity --adjustment 1 --cooldown 120 --auto-scaling-group WebAutoScaleGroup

Create an autoscaling (scale up) policy

Chapter 9, Monitoring and Scaling My Application

as-put-scaling-policy WebScaleDown --type ChangeInCapacity "--adjustment=-1" --cooldown 120 --auto-scaling-group WebAutoScaleGroup

Create an autoscaling (scale down) policy

Chapter 9, Monitoring and Scaling My Application

as-describe-auto-scaling-groups --headers

List all of the autoscale groups

Chapter 9, Monitoring and Scaling My Application

There is no console access to Amazon Autoscaling.

Approximate costs

Amazon Autoscaling carries no additional fees for its use other than standard fees associated with EC2 instances, storage, and bandwidth.

Amazon CloudFront

Amazon CloudFront provides caching of website data in distributed locations worldwide to improve the performance of websites hosted in an AWS data center.

The following figure shows the AWS console location for CloudFront:

Approximate costs

The calculation for costs is complex and based on HTTP requests as well as the size of data transferred. However, as a rough guide:

One (1) TB of data transferred each month for the period of one year in the US region = $1,843.

Amazon SimpleDB

SimpleDB provides a simple key/value store for the reliable storage of simple data of any size.

Tools are located at

http://aws.amazon.com/code/1137

Development libraries are located at:

There is no console access to Amazon SimpleDB.

Approximate costs

It is complex to approximate the cost for SimpleDB, however, as a rough guide:

One (1) TB of data stored in SimpleDB for a year will cost = $3,077.

If all of the data was transferred out in one year, data transfer cost = $1,843.

Amazon Relational Database Service (RDS)

RDS provides a MySQL instance running and managed by AWS.

Command-line tools

The command-line tools are provided by Amazon staff and are located at:

http://aws.amazon.com/developertools/2928

This is the only environment variable used:

Set AWS_RDS_HOME

The following screenshot shows the AWS console location for RDS:

Summary of instance types and costs:

Name

Description

Approximate Cost/year

(on demand, costs include 1 TB of storage running for one year and are for comparison only and are in $US)

Small RDS Instance

1.7 GB RAM, 1 EC2 compute unit, moderate IO

$2,192

Large RDS Instance

7.5 GB RAM, 4 EC2 compute unit, high IO

$5,083

Extra Large RDS Instance

15 GB RAM, 8 EC2 compute units, high IO

$8,937

High Memory Extra Large RDS Instance

17.1 GB RAM, 6.5 EC2 compute units, high IO

$6,922

High Memory Double Extra Large RDS Instance

34 GB RAM, 13 EC2 compute units, high IO

$12,616

High Memory Quadruple Extra Large RDS Instance

68 GB RAM, 26 EC2 compute units, high IO

$24,004

Amazon Simple Queue Service (SQS)

SQS provides for reliable asynchronous queuing and delivery of messages.

Command-line tools

The command-line tools are provided by Amazon staff.

The scratchpad is located at:

http://aws.amazon.com/code/1254

The .Net SDK is located at:

http://aws.amazon.com/sdkfornet/

There is no console access to Amazon SQS.

Approximate pricing

Pricing is $0.01 per 10,000 requests.

Amazon Simple Notification Service (SNS)

SNS provides for reliable event and notification delivery to multiple endpoints such as mail and HTTP.

Command-line tools

Amazon does not currently supply command-line tools for SNS.

Subscription options

  • HTTPS

  • HTTP

  • E-mail

  • E-mail (JSON)

  • Amazon SQS

The following screenshot shows the AWS console location for SNS:

Approximate pricing

Pricing for one (1) TB of data transferred in/out of SNS every month over a twelve month period = $1,843

Amazon CloudWatch

CloudWatch provides monitoring and alerting of metrics within the EC2 AWS environment.

Command-line tools

The command-line tools are provided by Amazon staff.

The CloudWatch tools are located at:

http://aws.amazon.com/developertools/2534

The Cloudwatch environment variables used are:

set AWS_CLOUDWATCH_HOME=C:\AWS\CloudWatch-1.0.9.5
set PATH=C:\AWS\CloudWatch-1.0.9.5\bin;%PATH%
Commands used in the book:

The following are the commands for CloudWatch used throughout this book.

Command

Description

Chapter

mon-describe-alarms

Describe configured alarms

Chapter 9, Monitoring and Scaling My Application

mon-put-metric-alarm WebHighCPUAlarm  --comparison-operator  GreaterThanThreshold  --evaluation-periods  1 --metric-name  CPUUtilization  --namespace  "AWS/EC2"  --period  120  --statistic Average --threshold  80 --alarm-actions arn:aws:autoscaling:us-east-1:764516644405:scalingPolicy:d3c53ac8-fa73-4cfd-9a06-a5f9d7e1a58f: autoScalingGroupName/WebAutoScaleGroup:policyName/WebScaleUp --dimensions "AutoScalingGroupName=WebAutoScaleGroup"

Create the cloud watch metric

Chapter 9, Monitoring and Scaling My Application

The following screenshot shows the AWS console location for CloudWatch:

Approximate pricing

Pricing for monitoring one instance is $3.50/month.

Amazon Virtual Private Cloud (VPC)

VPC allows the creation of custom, isolated compute environments with custom IP addressing schemes and isolated security.

Command-line tools

Command-line tools are provided by the EC2 command-line tools package.

AWS console

The following screenshot shows the AWS console location for VPC:

Approximate pricing

Pricing for one VPC connection over a one year period is = $438.

Amazon Elastic Load Balancing

ELB provides TCP/IP load balancing across multiple EC2 instances.

Command-line tools

Command-line tools are provided by the EC2 command-line tools package.

The following screenshot shows the AWS console location for ELB:

Approximate pricing

Pricing for one load balancer over a one year period if one (1) TB of data is transferred is = $317

Amazon Import/Export

Amazon import/export allows the transfer of large amounts of data in and out of AWS.

Command-line tools

The command-line tools are provided by Amazon staff and are located at:

http://awsimportexport.s3.amazonaws.com/importexport-webservice-tool.zip

Commands used in the book:

Command

Description

Chapter

java -jar lib/AWSImportExportWebServiceTool-1.0.jar CreateJob Import MyManifest.txt

Create a job information

Chapter 4, How Storage Works on Amazon

java -jar lib/AWSImportExportWebServiceTool-1.0.jar ListJobs

List all jobs

Chapter 4, How Storage Works on Amazon

java -jar lib/AWSImportExportWebServiceTool-1.0.jar CancelJob XHNHC

Cancel a job

Chapter 4, How Storage Works on Amazon

There is no console access to Amazon SQS.

Approximate pricing

Around $80 per device