EC2 has on demand use and pricing but if we know our usage we can reduce our costs a lot using various types of instances that are available in the cloud.
Following are the types of instances available in the AWS cloud:-
- On demand instances
- Reserved instances
- Spot instances
- Dedicated hosts
Let us learn about each of these in detail:-
These are the instances that we are most familiar with and often we can start them on demand and stop them whenever we want. These were mostly used by us in these exercises. In these for all Linux machines we are billed per second, for windows and mac machines we are billed per hour. It has the highest cost but no upfront payment is required we only pay when we use the instance. This is for short term and reliable workloads where you don't now when you want to start or stop using the instance.
In these instances we reserve a specific instance(with a specific type) for 1 to 3 years and we can get up to 75% discounts with respect to on demand instances. The discount depends upon reservation period 1 year or 3 years and the upfront cost. If you are willing to pay all upfront you get a bigger discount then of you pay on a later stage. these are used for databases, servers, etc. These are further subdivides into 2 categories
In these instances we can change the instance type like from t2.micro to t2.mini.
These instances are used within a specific time frame that you reserve like for a fraction of day, week, month. These can used for cron jobs, seasonal demand etc.
These instances provide the most cost saving with respect to on demand pricing even up to 90% but we can lost these type of instances at any point of time.
The hourly price for a Spot Instance is called a Spot price. The Spot price of each instance type in each Availability Zone is set by Amazon EC2, and is adjusted gradually based on the long-term supply of and demand for Spot Instances. Your Spot Instance stops running when the spot price exceeds your price provided for the spot instance it is like an auction if someone is willing to pay more he will get that spot instance.
These are physical servers that are dedicated to you. No one else work on these servers. I provides a lot of control over the underlying hardware to you. These are the most expensive and are reserved for 3 years. These are mostly used for compliance needs.
So, with this we are done with the basics of EC2. Next we will study how data is stored on various EC2 instances.