SlideShare a Scribd company logo
Introduction to ec2Mark Squires II – RAMP51Charlotte ALT.NETTarget Audience: Senior Developers/Architects
Amazon Web ServicesProvider of scalable infrastructure servicesCore Cloud ServicesElastic Compute Cloud (EC2)Push/Pull Messaging (SQS/SNS)Simple Data Service (SDB) Durable Storage (S3)
My Favorite Thing About AWSWhat I love most about AWS is it’s the only service I pay for monthly that routinely sends me emails with good news.Its always one of two possible emailsWe have lowered our pricesWe have added features
Not in this powerpointInformation about non EC2 servicesSecurity groupsSnapshots,or AMI’sHowever, we can talk about some of these things. I just wanted to prevent a 200 slide deck.
AWS Platform OverviewCourtesy of Mike Culver at AWS. (Approved Usage By AWS)This is actually outdated, as there is a 5th region now in Japan
What is EC2?Primarily Ec2 is the service that will provide you with a virtual instance that you can remote into (RDP/SSH)Create an instanceCreate a machine imageCreate a load balancerCreate snap shots of your disksCreate static ip addressAbility to swap drives and ip addresses between instancesAbility to use SSL Termination at the load balancerAbility to define intricate security groups and firewall rules between security groups and for external CIDR blocksAbility to monitor instances and create alertsAbility to load balance across multiple physical data centersEc2 does some other things too that are out of the scope of this presentation.
Components of EC2Elastic Block Store (EBS) – storageEBS SnapshottingAmazon CloudWatch – monitoringAmazon Machine ImagesAuto Scaling – horizontal scalingElastic Load BalancingVirtual Private Cloud – vpn bridgeElastic IP AddressHigh Performance Compute ClustersVMWare Image Import
Designed Expecting to FailThe cloud is NOT designed to prevent failure, but to anticipate failureWhile nearly any application can be deployed to EC2 the best applications for EC2 have already been designed expecting failures
Non-CommittalNo long term commitments requiredFree to play the fieldMix and Match cloud services and cloud providers
What you get?The price of an instance is based on attributes of the type of instance you created.Windows costs more than Linux. (Amazon kindly includes the cost of your windows license in the price)More memory, more CPU drive up the hourly cost
What’s included?When you buy an instance you are renting:A fixed allotment of CPU measured in Elastic Compute Units (ECUs)A fixed allotment of Memory (RAM)Some instance types offer a fixed allotment of temporary ephemeral storage
Instance Type ClassesMicrot1.micro(*up to 2 ECU)Standardm1.small(1 ECU)m1.large(2 ECU * 2 core)m1.xlarge(2 ECU * 4 core)High Memorym2.xlarge(3.25 ECU * 2 core)m2.2xlarge(3.25 ECU * 4 core)m2.4xlarge(3.25 ECU * 8 core)High Compute
c1.medium
c1.xlarge
Cluster Compute
cc1.4xlarge
Cluster GPU
cg1.4xlarge*t1.micro is burstable, you share the CPU with others and get any unused cpu Cycles when neededNodes in yellow are 32-bit, other are 64-bit
Geez. What does it cost?There is a sea of pricing options making it very flexible.You can get very creative in how you manage these costs.There are three major pricing schemes for an EC2 instance.On-Demand PricingReserved PricingSpot Pricing
It’s Priced HourlyThese prices are only for one particular instance size, the T1.MICRO which is the smallest & cheapest instance typeThe pricing plans are not only different in pricing, but also have differences in instance availability
An Instance HourEach hour or partial hour you are using any EC2 Instance counts as an “Instance Hour” you are billed by the instance hour
On Demand PricingRequest an instance on demand and use it until you are done with itMore expensive than other pricing options from an hourly perspectiveContingent on Capacity, if AWS has no available capacity for the instance type in the availability zone that you requested, you will get an “out of capacity” error.
Reserved Pricing PlanRequires a 1 year or 3 year commitment and a corresponding commitment feeCan’t be used on SQL Server Standard instancesUsually saves ~30-55% for instances that are run continually (24x7)Guarantees you that an instance for your reservation type in the AZ of your reservation will always be available upon your request
UnderstandingReserved PricingReserved Pricing Doesn’t buy you another instanceAssume you use a Linux t1.micro instance 24x7 for an entire year ON-DEMAND. You are paying for 24*365=8760 instance hours @ $0.02$175.20 per yearIf you buy a “1 Year Reservation” for a Linux t1.micro instance, you have simply bought the right to pay $0.007 per hour for ~8760 instance hours during the next year instead of $0.02 per hour.It doesn’t apply to any particular ec2 instance, it’s more of a billing discount, the 1 year reservation you just purchased will be automatically apply to one of your existing instances that match the reservation criteriaIt does however guarantee that at least one type of this instance will be available for your use whenever you need it
Spot PricingHow Amazon monetizes all it’s available resourcesWorks like the stock marketMore Demand = Higher PriceBid based model, people who Bid more will steal resources from the person with the lowest bidShould only be used to host applications that have tolerance for being randomly shut down without noticeUsually the cheapest pricing, but not always
ASP.NET on EC2Easily load balance your ASP.NET app using an EC2 Elastic Load BalancerSQL Server can be costly unless your application can run on SQL Server ExpressRAMP51 is currently running multiple asp.net websites using1 – ELB (to allow easy horizontal scaling)1 - t1.micro   1 - m1.small (hosting SQL express)1 – db.m1.small MySQL RDS Instance1 – Simple DB Database
Creative Cost SavingsHorizontal scaling up of application tiers during peak hours and down during slow hours, reducing instance hours to be paid for; via Auto Scaling groups or Spot Instance Tier Blooming (I made this term up I think)Spot Instance Tier BloomingBlooming your web tier with extra instance based on spot pricing, for example (add as many t1.micro instances to my web tier as I can get for $0.10/hr during the hours of 9am est – 5pm estNot sure any applications exist yet that will do this but its an idea I’ve been pondering
More Cost SavingsUsing MySql via Amazon RDSUsing SimpleDB ServiceUsing a SQL Azure instance from your EC2 Instance (haven’t tested latency of this)Moving web assets onto S3/CloudFront reducing bandwidth costs and load on instances
Instance ManagementAll instances have basicCloudWatch monitoring which monitors IO, CPU, MemoryDetailed monitoring is available which monitors at a higher interval than basicAWS is driven by a powerful set of APIs so you either need to write code or use a tool to manage your AWS resources

More Related Content

Introduction to EC2

  • 1. Introduction to ec2Mark Squires II – RAMP51Charlotte ALT.NETTarget Audience: Senior Developers/Architects
  • 2. Amazon Web ServicesProvider of scalable infrastructure servicesCore Cloud ServicesElastic Compute Cloud (EC2)Push/Pull Messaging (SQS/SNS)Simple Data Service (SDB) Durable Storage (S3)
  • 3. My Favorite Thing About AWSWhat I love most about AWS is it’s the only service I pay for monthly that routinely sends me emails with good news.Its always one of two possible emailsWe have lowered our pricesWe have added features
  • 4. Not in this powerpointInformation about non EC2 servicesSecurity groupsSnapshots,or AMI’sHowever, we can talk about some of these things. I just wanted to prevent a 200 slide deck.
  • 5. AWS Platform OverviewCourtesy of Mike Culver at AWS. (Approved Usage By AWS)This is actually outdated, as there is a 5th region now in Japan
  • 6. What is EC2?Primarily Ec2 is the service that will provide you with a virtual instance that you can remote into (RDP/SSH)Create an instanceCreate a machine imageCreate a load balancerCreate snap shots of your disksCreate static ip addressAbility to swap drives and ip addresses between instancesAbility to use SSL Termination at the load balancerAbility to define intricate security groups and firewall rules between security groups and for external CIDR blocksAbility to monitor instances and create alertsAbility to load balance across multiple physical data centersEc2 does some other things too that are out of the scope of this presentation.
  • 7. Components of EC2Elastic Block Store (EBS) – storageEBS SnapshottingAmazon CloudWatch – monitoringAmazon Machine ImagesAuto Scaling – horizontal scalingElastic Load BalancingVirtual Private Cloud – vpn bridgeElastic IP AddressHigh Performance Compute ClustersVMWare Image Import
  • 8. Designed Expecting to FailThe cloud is NOT designed to prevent failure, but to anticipate failureWhile nearly any application can be deployed to EC2 the best applications for EC2 have already been designed expecting failures
  • 9. Non-CommittalNo long term commitments requiredFree to play the fieldMix and Match cloud services and cloud providers
  • 10. What you get?The price of an instance is based on attributes of the type of instance you created.Windows costs more than Linux. (Amazon kindly includes the cost of your windows license in the price)More memory, more CPU drive up the hourly cost
  • 11. What’s included?When you buy an instance you are renting:A fixed allotment of CPU measured in Elastic Compute Units (ECUs)A fixed allotment of Memory (RAM)Some instance types offer a fixed allotment of temporary ephemeral storage
  • 12. Instance Type ClassesMicrot1.micro(*up to 2 ECU)Standardm1.small(1 ECU)m1.large(2 ECU * 2 core)m1.xlarge(2 ECU * 4 core)High Memorym2.xlarge(3.25 ECU * 2 core)m2.2xlarge(3.25 ECU * 4 core)m2.4xlarge(3.25 ECU * 8 core)High Compute
  • 18. cg1.4xlarge*t1.micro is burstable, you share the CPU with others and get any unused cpu Cycles when neededNodes in yellow are 32-bit, other are 64-bit
  • 19. Geez. What does it cost?There is a sea of pricing options making it very flexible.You can get very creative in how you manage these costs.There are three major pricing schemes for an EC2 instance.On-Demand PricingReserved PricingSpot Pricing
  • 20. It’s Priced HourlyThese prices are only for one particular instance size, the T1.MICRO which is the smallest & cheapest instance typeThe pricing plans are not only different in pricing, but also have differences in instance availability
  • 21. An Instance HourEach hour or partial hour you are using any EC2 Instance counts as an “Instance Hour” you are billed by the instance hour
  • 22. On Demand PricingRequest an instance on demand and use it until you are done with itMore expensive than other pricing options from an hourly perspectiveContingent on Capacity, if AWS has no available capacity for the instance type in the availability zone that you requested, you will get an “out of capacity” error.
  • 23. Reserved Pricing PlanRequires a 1 year or 3 year commitment and a corresponding commitment feeCan’t be used on SQL Server Standard instancesUsually saves ~30-55% for instances that are run continually (24x7)Guarantees you that an instance for your reservation type in the AZ of your reservation will always be available upon your request
  • 24. UnderstandingReserved PricingReserved Pricing Doesn’t buy you another instanceAssume you use a Linux t1.micro instance 24x7 for an entire year ON-DEMAND. You are paying for 24*365=8760 instance hours @ $0.02$175.20 per yearIf you buy a “1 Year Reservation” for a Linux t1.micro instance, you have simply bought the right to pay $0.007 per hour for ~8760 instance hours during the next year instead of $0.02 per hour.It doesn’t apply to any particular ec2 instance, it’s more of a billing discount, the 1 year reservation you just purchased will be automatically apply to one of your existing instances that match the reservation criteriaIt does however guarantee that at least one type of this instance will be available for your use whenever you need it
  • 25. Spot PricingHow Amazon monetizes all it’s available resourcesWorks like the stock marketMore Demand = Higher PriceBid based model, people who Bid more will steal resources from the person with the lowest bidShould only be used to host applications that have tolerance for being randomly shut down without noticeUsually the cheapest pricing, but not always
  • 26. ASP.NET on EC2Easily load balance your ASP.NET app using an EC2 Elastic Load BalancerSQL Server can be costly unless your application can run on SQL Server ExpressRAMP51 is currently running multiple asp.net websites using1 – ELB (to allow easy horizontal scaling)1 - t1.micro 1 - m1.small (hosting SQL express)1 – db.m1.small MySQL RDS Instance1 – Simple DB Database
  • 27. Creative Cost SavingsHorizontal scaling up of application tiers during peak hours and down during slow hours, reducing instance hours to be paid for; via Auto Scaling groups or Spot Instance Tier Blooming (I made this term up I think)Spot Instance Tier BloomingBlooming your web tier with extra instance based on spot pricing, for example (add as many t1.micro instances to my web tier as I can get for $0.10/hr during the hours of 9am est – 5pm estNot sure any applications exist yet that will do this but its an idea I’ve been pondering
  • 28. More Cost SavingsUsing MySql via Amazon RDSUsing SimpleDB ServiceUsing a SQL Azure instance from your EC2 Instance (haven’t tested latency of this)Moving web assets onto S3/CloudFront reducing bandwidth costs and load on instances
  • 29. Instance ManagementAll instances have basicCloudWatch monitoring which monitors IO, CPU, MemoryDetailed monitoring is available which monitors at a higher interval than basicAWS is driven by a powerful set of APIs so you either need to write code or use a tool to manage your AWS resources
  • 30. Major Tools AvailableElasticFox – Firefox plugin, which I happen to prefer for most tasksOpen source, but it appears Amazon stopped updating it mid 2010There is probably some space for another open source version aside from elastic foxAmazon Web Console – supports a lot of management functionsDoes more than elasticfoxUseful for many services not just EC2Command Line Tools available for all services. The command line tools are usually the first to support new features.
  • 31. Auto ScalingEC2 offers the ability for you to automatically scale a group of services up and down based on a metricFor example, you have an auto-scaling group that has 2 instances serving web requestsYou could define an auto-scaling rule such as: if the avg. CPU usage exceed 85% for longer than 5 minutes add 2 more instances, and when the avg. CPU drops below 50% for more than 20 minutes shut down two instancesThere are a wide variety of configurations you can create that can leverage a number of metrics
  • 32. DemonstrationAuto-Scaling an ASP.NET App that writes to Simple DB for shared data accesshttp://cltaltnetdemo.ramp51.com
  • 33. Setting up CMD ToolsIAM Toolshttp://bit.ly/fb6Va6EC2 Toolshttp://bit.ly/h7dIxAELB Toolshttp://bit.ly/fAm90a
  • 34. Useful LinksEC2 Overviewhttp://aws.amazon.com/ec2/EC2 Pricinghttp://aws.amazon.com/ec2/pricing/AWS Bloghttp://aws.typepad.com/AWS SDK for .NEThttp://aws.amazon.com/sdkfornet/