15660: Update documentation about using preemptible instances with c-d-c
[arvados.git] / doc / admin / spot-instances.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: Using AWS Spot instances
5 ...
6
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
13 This page describes how to set up crunch to take advantage of "Amazon's EC2 spot instances":https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html.
14
15 h2. Configuration
16
17 To use spot instances, set @UsePreemptibleInstances: true@ and add entries to @InstanceTypes@ with @Preemptible: true@.  Typically you want to add both preemptible and non-preemptible entries for each cloud provider VM type.  The @Price@ for preemptible instances is the maximum bid price, the actual price paid is dynamic and may be lower.  For example:
18
19 <pre>
20 Clusters:
21   uuid_prefix:
22     Containers:
23       UsePreemptibleInstances: true
24     InstanceTypes:
25       m4.large:
26         Preemptible: false
27         ProviderType: m4.large
28         VCPUs: 2
29         RAM: 8GiB
30         AddedScratch: 32GB
31         Price: 0.1
32       m4.large.spot:
33         Preemptible: true
34         ProviderType: m4.large
35         VCPUs: 2
36         RAM: 8GiB
37         AddedScratch: 32GB
38         Price: 0.1
39 </pre>
40
41 When @UsePreemptibleInstances@ is enabled, child containers (workflow steps) will automatically be made preemptable.  If the instance running a step is preempted, it will be restarted on a new instance.  However, because preempting the workflow runner would cancel the entire workflow, the workflow runner runs in a reserved (nonpreemptable) instance.
42
43 If you are using "crunch-dispatch-cloud":{{site.baseurl}}/install/install-dispatch-cloud.html no additional configuration is required.
44
45 If you are using the legacy Nodemanager, "see below":#nodemanager .
46
47 h3. AWS Permissions
48
49 When requesting spot instances, Amazon's API may return an authorization error depending on how users and permissions are set on the account. If this is the case check logs for this error:
50
51 <pre>
52 BaseHTTPError: AuthFailure.ServiceLinkedRoleCreationNotPermitted: The provided credentials do not have permission to create the service-linked role for EC2 Spot Instances.
53 </pre>
54
55 The account needs to have a service linked role created. This can be done by logging into the AWS account, go to _IAM Management_ &rarr; _Roles_ and create the @AWSServiceRoleForEC2Spot@ role by clicking on the @Create@ button, selecting @EC2@ service and @EC2 - Spot Instances@ use case.
56
57 h3. Cost Tracking
58
59 Amazon's Spot instances prices are declared at instance request time and defined by the maximum price that the user is willing to pay per hour. By default, this price is the same amount as the on-demand version of each instance type, and this setting is the one that nodemanager uses for now, as it doesn't include any pricing data to the spot instance request.
60
61 The real price that a spot instance has at any point in time is discovered at the end of each usage hour, depending on instance demand. For this reason, AWS provides a data feed subscription to get hourly logs, as described on "Amazon's User Guide":https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html.
62
63 h2(#nodemanager). Nodemanager
64
65 If you are using the legacy Nodemanager, its config file must also declare preemptible instance sizes, which must match the API server's @InstanceTypes@:
66
67 <pre>
68 [Size m4.large]
69 cores = 2
70 scratch = 32000
71
72 [Size m4.large.spot]
73 cores = 2
74 instance_type = m4.large
75 preemptible = true
76 scratch = 32000
77 </pre>