\u201cThe cloud\u201d changed the game so much, and so quickly, it's difficult to remember what things were like before it arrived. But, not that long ago, getting server resources meant buying or leasing an actual box off the rack of a server farm. It wasn\u2019t instant. It wasn\u2019t cheap. And it usually required a great deal of technical knowledge.\r\n\r\n"The cloud" freed us from the constraints of working with individual boxes. Instead, it offered an immense pool of resources that could be borrowed from as needed. Renting \u201cshares\u201d of the cloud eliminated the need to invest in hardware upfront and provided near instant scaling. Its value was a one-two combination of economies of scale and elastic autoscaling driving down the cost and \u201cinfrastructure as a service\u201d lowering the knowledge barrier. We haven\u2019t looked back since.\r\n\r\nOne of the most important cloud services is <a href="https:\/\/aws.amazon.com\/ec2\/">Amazon Elastic Cloud Compute (EC2)<\/a> which was introduced in 2006. EC2 quickly became one of the most popular AWS services and remains so today.\r\n<h2>What is EC2?<\/h2>\r\n<iframe src="https:\/\/www.youtube.com\/embed\/TsRBftzZsQo" width="560" height="315" frameborder="0" allowfullscreen="allowfullscreen"><\/iframe>\r\n\r\nYou can think of EC2 as the cloud equivalent of a server. A server, broken down to its essential elements, is a combination of storage and compute resources that can be remotely accessed.\r\n\r\nWhat you\u2019re actually getting with EC2 is a <a href="https:\/\/en.wikipedia.org\/wiki\/Virtual_machine" target="_blank" rel="noopener noreferrer">virtual machine<\/a> which AWS calls an \u201cinstance.\u201d It includes all the resources of a physical server but it\u2019s not a distinct box \u2014 it\u2019s a slice of a much larger pie. Functionally, it\u2019s the exact same thing but behind the scenes it\u2019s more like tapping into an ocean of resources. There aren\u2019t really any downsides to using a virtual machine versus a physical machine. In fact, there are only advantages.\r\n\r\nYou can get as much, or as little, compute capacity as needed for your project and scale up and down as your needs change over time. And, it\u2019s really easy to do so. EC2 is a web service so you can log in and <a href="https:\/\/docs.aws.amazon.com\/efs\/latest\/ug\/gs-step-one-create-ec2-resources.html" target="_blank" rel="noopener noreferrer">create a new EC2 instance<\/a> quickly and without the technical knowledge that would normally be required to provision a server.\r\n<h2>Why use EC2?<\/h2>\r\nIn less than 10 minutes you can rent a slice of Amazon\u2019s vast cloud network and put those computing resources to work on anything from data science to bitcoin mining.\r\n\r\nEC2 offers a number of benefits and advantages over alternatives. Most notably:\r\n<h3>Affordability<\/h3>\r\nEC2 allows you to take advantage of Amazon\u2019s enormous scale. You can pay a very low rate for the resources you use. The smallest EC2 instance can be rented for as little as $.0058 per hour which works out to about $4.18 per month. Of course, instances with more resources are more expensive but this gives you a sense of how affordable EC2 instances are.\r\n\r\nWith EC2 instances, you\u2019re only paying for what you use in terms of compute hours and bandwidth so there\u2019s little wasted expense.\r\n<h3>Ease of use<\/h3>\r\nAmazon\u2019s goal with EC2 was to make accessing compute resources low friction and, by and large, they\u2019ve succeeded. Launching an instance is simply a matter of logging into the AWS Console, selecting your operating system, instance type, and storage options. At most, it\u2019s a 10 minute process and there aren\u2019t any major technical barriers preventing anyone from spinning up an instance, though it may take some technical knowledge to leverage those resources after launch.\r\n<h3>Scalability<\/h3>\r\nYou can easily add EC2 instances as needed, creating your own private cloud of computer resources that perfectly matches your needs. Here at Pagely a common configuration is an EC2 instance to run a WordPress app, an instance to run <a href="https:\/\/pagely.com\/blog\/amazon-rds\/">RDS<\/a> (a database service), and an EBS so that data can easily be moved and shared between instances as they\u2019re added.\r\n\r\nAWS offers built-in, rules-based autoscaling so that you can automatically turn instances on or off based on demand. This helps you ensure that you\u2019re never wasting resources but you also have enough resources available to do the job.\r\n<h3>Integration<\/h3>\r\nPerhaps the biggest advantage of EC2, and something no competing solution can claim, is its native integration with the vast ecosystem of AWS services. Currently there are over 170 services. No other cloud network can claim the breadth, depth, and flexibility AWS can.\r\n<h2>What can you do with EC2 instances?<\/h2>\r\nAnything you can do with a computer, you can do with EC2. Data scientists use EC2 instances to crunch large data sets. Animators use EC2 instances to render 3D worlds. At Pagely we use EC2 instances to serve websites for our <a href="https:\/\/pagely.com\/blog\/managed-wordpress-hosting\/">Managed WordPress Hosting<\/a> <a href="https:\/\/pagely.com\/case-studies\/">customers<\/a>.\r\n\r\nInstances come in a variety of different hardware configurations (memory and CPU) called \u201ctypes\u201d and are grouped into six families. Each family has a variety of instance types that have resources optimized for specific use cases.\r\n\r\nTo understand all the different ways EC2 instances can be leveraged, it can be helpful to explore the available instance families so you understand what\u2019s available and how it can be put to use.\r\n\r\nThe first letter of the instance type indicates which family it is in. For instance, a c5.2xlarge is in the compute-optimized family (as indicated by the \u201cC\u201d) and a p3dn.24xlarge is in the accelerated computer family (as indicated by the \u201cP\u201d).\r\n<h3>General purpose instances<\/h3>\r\n<strong>A, T, and M<\/strong>\r\nGeneral purpose instances are simple instances with modest options best suited for testing environments. Generally, you would not want to use them as a production server.\r\n\r\nM instances offer more balanced resources and are suitable for more general use (they\u2019re powerful enough to be used for production on a budget).\r\n<h3>Compute-optimized instances<\/h3>\r\n<strong>C<\/strong>\r\nCompute-optimized instances offer a low price per compute ratio making them a cost-effective solution for compute-heavy applications like web servers, machine\/deep learning inference, ad serving, highly scalable multiplayer gaming, and video encoding.\r\n<h3>Accelerated computing<\/h3>\r\n<strong>P, G, F<\/strong>\r\nThese are GPU optimized instances for graphics-intensive applications or GPU compute applications. These instances are well-suite for speech analysis, machine learning, 3D rendering, and genomics research.\r\n<h3>Memory optimized instances<\/h3>\r\n<strong>X1e, X1, R<\/strong>\r\nMemory-optimized instances are for applications that don\u2019t require a lot of compute resources and instead require a lot of RAM. Often these instances are useful for data science applications \u2014 such as data mining and data analysis \u2014 where the data set can be stored in RAM.\r\n<h3>Storage optimized instances<\/h3>\r\n<strong>H, I, D<\/strong>\r\nStorage optimized instances deliver high disk throughput, low latency SSD, or HDD storage for a variety of storage heavy applications like distributed file systems, big data workload clusters, data processing applications like Apache Kafka, elastic search, and NoSQL databases.\r\n\r\nThe range of hardware options on these instance types can be overwhelming. You can use a resource like https:\/\/www.ec2instances.info\/ to make comparisons and find the hardware that\u2019s best for your application.\r\n<h2>Persistent storage with EBS<\/h2>\r\nAn instance can be launched with its native storage (boot disk) or, optionally, Elastic Block Store (EBS) can be added as a service. EBS\u2019s main advantage is that it can be easily attached to any instance. Using the storage provided by an instance makes it more difficult to share data with an instance and once that instance is turned off that data is no longer available (this is called ephemeral storage).\r\n<h2>Pricing<\/h2>\r\nAmazon provides a generous free tier for exploring many of its products including 750 free hours over 12 months for EC2 instances.\r\n\r\nWhen you\u2019re ready to purchase an instance they offer three options:\r\n<ul>\r\n \t<li>On-Demand Instances\r\n<ul>\r\n \t<li>Pay only for what you use.<\/li>\r\n \t<li>No long-term commitments or upfront payments.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Reserved Instances\r\n<ul>\r\n \t<li>One-time, upfront payment for a period of 1-3 years.<\/li>\r\n \t<li>Machine is always on.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li>Save a significant amount of money by pre-paying.\r\n<ul>\r\n \t<li>Spot Instances<\/li>\r\n \t<li>Purchase unused EC2 instances at a discount for significant cost savings.<\/li>\r\n \t<li>Machine could be taken down by Amazon so not a good option if continuous uptime is important.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\nSo to simplify things, a reserved instance is great if you have a long-term need for an instance that is always on.\r\n\r\nIf you want to save money, you can go with an On-Demand or Spot instance but if it\u2019s important that machine be available when you need it, On-Demand is your best option.\r\n\r\n<a href="https:\/\/cloudacademy.com\/blog\/ec2-pricing-how-to-compute-costs-on-aws\/">This flowchart from Cloud Academy<\/a> summarizes this nicely:\r\n\r\n<img class="lazy aligncenter wp-image-20253 size-full" src="https:\/\/pagely.com\/wp-content\/uploads\/2019\/06\/choosing-ec2-instance-type-flowchart.png" alt="Flowchart for choosing an EC2 Instance type" width="674" height="197" \/>\r\n\r\n<a href="https:\/\/cloudacademy.com\/blog\/ec2-pricing-how-to-compute-costs-on-aws\/">Source<\/a>\r\n<h2>Why we use EC2 at Pagely<\/h2>\r\nHere at Pagely we use C5 instances and VBurst instances. We analyzed many instance types and found these best suited for the unique resource demands of WordPress. Along with <a href="https:\/\/pagely.com\/blog\/amazon-rds\/">AWS RDS<\/a> as our database solution, they allow us to <a href="https:\/\/pagely.com\/blog\/wordpress-data-reliability\/">serve web pages quickly and reliably<\/a>.\r\n\r\nThe reason we chose EC2 over competing solutions can be boiled down to one important advantage: EC2 is part of the <a href="https:\/\/pagely.com\/wp-aws\/">AWS cloud ecosystem<\/a>. No other cloud solution comes close in terms of number of services (<a href="https:\/\/aws.amazon.com\/products\/">over 170+<\/a> and counting). The breadth and depth of services offered by AWS is currently unmatched. There are less expensive cloud providers on the market but we chose the AWS ecosystem because it offers our customers unparalleled flexibility. All those services and instance types allow us to meet the demands of any customer \u2014 whether they\u2019re a blogger, an ecommerce store, or an international enterprise with unique and demanding requirements. AWS can do it all -- reliably and securely.