Using EC2 Spot instances

On Amazon EC2, go to https://aws.amazon.com/ec2/spot/ and we will find the page as shown in the following screenshot. Log onto the AWS Console for Spot instances to set up some of them:

Figure 7.8: The landing page of AWS Spot instances

On the navigation bar, we see Spot Requests. Click it to go to the Spot Requests screen as shown in the following screenshot. On this screen, clicking Request Spot Instances starts the request process:

Figure 7.9: The Spot Requests screen on AWS displaying a request with its associated instances

There are three models for requesting Spot instances:

  • One-time request. This is one time only, so when the instance is gone, we need to do another request.
  • Request a fleet of instances and let AWS maintain the number of target instances. When some instances are terminated, AWS will try its best, depending on our maximum bidding price, to allocate instances to meet the target numbers of each fleet. We have opted for this request model in this chapter.
  • Request instances for a fixed period of time. A fixed period is called a Spot block, which is between 1 and 6 hours. We will pay more if we set the longer period.

The following diagram shows what the cluster in preparation will look like:

Figure 7.10: A Docker cluster forming on Spot instances using an automatic operator to take care of it

Assume that we already have three boxes provisioned to be managers. To get the cheapest rate possible, it is recommended using three on-demand EC2 nodes as Docker managers, and N-3 Spot instances as Docker workers. We start small with three Spot workers.

If possible, choose a cloud provider that allows you to create a private network and floating IPs. We will form a Docker cluster on the private network. Most cloud providers allow this, so do not worry.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset