AWS Insight: Spot Instances

    Hello! image

    Continuing the topic of saving money in the clouds, today I will talk about Spot Instances . Let me remind you that AWS has at least 3 main types of cost optimization:


    What is Spot instance?


    This is a regular EC2 or VPC instance, but there are some nuances of work:
    1. As mentioned earlier, this is a regular instance. Computing and network resources, disk speeds and everything else on machines is the same as regular EC2 instances.
    2. You set the price that you will pay for the hour you use the instance. You will not pay more.
    3. An instance can be turned off at any time if, for example, someone has offered a price more for the slot that you occupy, but there are no others.
    4. Payment is made for the full hour of the instance. Part of the hour is discarded in favor of the client - down to the full hour.

    Spot instances use unoccupied EC2 slots to keep them idle.

    Why use machines that might turn off any minute?


    Everything is very simple. It is cheap. If the criticality of uptime is not important, then this is an ideal option.

    Here's a simple user case for using Spot instances. Every night, your application collects images that users have downloaded in a day and creates icons from them. Everything is ridiculously simple: 50 Medium High-CPU instances rise, look at SQS and in turn process everything in the uploaded folder in your S3 bucket. Well, they add it to the processed folder.

    They usually do it in 2 hours. It makes no sense to reserve them for such an amount of time, even Light Utilization Reservation will not cover the costs. For these 2 hours for instances you will pay

    2 * 50 * $ 0.165 = $ 16.5 per day and ~ $ 511 per month .

    You can save on this. You just need to start using Spot Instances. At the time of writing, the cost of the Spot Medium High-CPU instance is $ 0.018 . Feel the difference between $ 0.018 and $ 0.165 . So, we put in the application an average of 2 times the cost of the spot instance per hour, so that our bets are probably not interrupted. And we get the following calculations:

    2 * 50 * $ 0.036 = $ 3.6 per day and ~ $ 111 per month .

    In this scenario, we get ~ 80% savings. The only thing we need to remember is that the instance can be put out. Proper file handling is what should be incorporated into your software.

    How to order a spot instance?


    In the Instances menu in the console, find Spot Requests and create a new request. We select prepared AMI with our software. Next, drive in the parameters of the spot request:
    image

    Well, then, as a normal instance.

    You can read more about spot instances on the official page . There are many pictures and various kinds of explanations why this is all cool.

    Finally, a small questionnaire on the topic.

    Only registered users can participate in the survey. Please come in.

    Do you use instances in your Spot projects?

    • 8.5% Yes 10
    • 19.6% No 23
    • 21.3% Have been thinking about this for a long time 25
    • 29.9% Thank you, after your explanation I will definitely become! 35
    • 20.5% No, this idea doesn't impress me 24

    Also popular now: