Launching Spot Instances | Scribe

    Launching Spot Instances

    • Hafeez Baig |
    • 16 steps |
    • 2 minutes
    information ordinal icon

    Refer to the following guide to learn how to use IAM in the cloud<https://scribehow.com/shared/Creating_an_IAM_User_and_User_Group_in_AWS_Management_Console__hWNiiXlcRJKFqYZZEJD-cg>

    1

    Sign in to **AWS Management Console** as an **IAM User** **Pre-requisite** - Ensure you have selected the AWS region closest to your location\ For this guide, we will be using us-east-2 (Ohio) as a preferred choice

    2

    Type **EC2** in the search bar and click on **EC2** to view the EC2 Dashboard

    3

    On the EC2 dashboard, Scroll to the **launch instance** section and click on **Launch instance** button

    4

    Click on "**Spot instances**" option

    information ordinal icon

    **What are Spot Instances?** Spot Instances are discounted compute resources (virtual machines) offered at up to 90% off on-demand pricing. They leverage unused EC2 capacity, so the benefit is significant cost savings. However, the trade-off is that AWS can reclaim the instance with a two-minute notice if they need the capacity. This makes them ideal for fault-tolerant, non-critical workloads.

    5

    Click on **Customize spot instance options** link to customize the options

    information ordinal icon

    **Why one should go for spot instance customization?** Spot Instances (AWS) are pre-built, but you can tailor your use to optimize costs (bid prices), pick ideal instance types, and design for interruptions (autoscaling) to maximize cost savings while mitigating disruption risks.

    6

    Click on **Set your maximum price (per instance/hour)** option to set the price

    7

    If you set the price to "**0.005"**, it will be the maximum price for spot instances

    8

    You can set the **Request type** as one-time or persistent, select **Persistent**

    9

    Scroll to the **Interruption behavior** section where you can set the interruption behavior, select "**Terminate**" as the Interruption behavior to Terminate the Instance

    10

    Click on **Launch instance** button

    11

    To request spot instances, On the same page click on **Spot Requests** from the left bar to view the Spot Requests

    12

    Click on the **Request Spot Instances** button from the top right of the page

    13

    Create Spot Fleet Request wizard will open, select Launch parameter as **Manually configure launch parameters,** and under the **AMI** section select the AMI as **Amazon Linux 2**

    information ordinal icon

    **What is a spot fleet request?** A Spot Fleet request (AWS) is like a bulk order for discounted Spot Instances. You specify how many instances you need, and the fleet automatically launches and maintains that number, finding the cheapest options and even replacing interrupted instances. Great for cost-effective, scalable workloads that can handle disruptions.

    14

    Scroll to the **Target capacity** section and set the Total target capacity as "**1"**

    15

    Scroll to the **Allocation strategy** and set the Spot allocation strategy as **Price capacity optimized**

    information ordinal icon

    **What is an Allocation Strategy ?** An Allocation Strategy determines how services like EC2 Auto Scaling or Batch choose which resources to provision for your workload. It's basically a rule for picking the most suitable instances. There are two main options: - **Price-Capacity Optimized :** This prioritizes the cheapest option, be it on-demand instances or Spot Instances (potentially leading to interruptions). - **Capacity Optimized :** This balances cost with availability, aiming for cheap Spot Instances with a lower risk of interruption.