-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstance-host-prices.sql
168 lines (168 loc) · 5.16 KB
/
instance-host-prices.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
INSERT INTO "instance-host-prices" (
"instanceFamily",
"location",
/* On demand */
"onDemandLinuxHr",
/* Reserved 1Y no upfront */
"reserved1yNoUpfrontLinuxHr",
/* Reserved 3Y no upfront */
"reserved3yNoUpfrontLinuxHr",
/* Reserved 1Y partial upfront */
"reserved1yPartialUpfrontLinuxQuantity",
"reserved1yPartialUpfrontLinuxHr",
/* Reserved 3Y partial upfront */
"reserved3yPartialUpfrontLinuxQuantity",
"reserved3yPartialUpfrontLinuxHr",
/* Reserved 1Y all upfront */
"reserved1yAllUpfrontLinuxQuantity",
/* Reserved 3Y all upfront */
"reserved3yAllUpfrontLinuxQuantity"
)
SELECT
"Instance Type" AS "instanceFamily",
LOWER("us-east-1") AS "location",
/* On demand */
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "OnDemand"
AND "Tenancy" = "Host"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "Unit" = "Hrs"
) AS "onDemandLinuxHr",
/* Reserved 1Y no upfront */
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "1%"
AND "PurchaseOption" LIKE "No%"
AND "OfferingClass" = "standard"
AND "Unit" = "Hrs"
) AS "reserved1yNoUpfrontLinuxHr",
/* Reserved 3Y no upfront */
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "3%"
AND "PurchaseOption" LIKE "No%"
AND "OfferingClass" = "standard"
AND "Unit" = "Hrs"
) AS "reserved3yNoUpfrontLinuxHr",
/* Reserved 1Y partial upfront */
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "1%"
AND "PurchaseOption" LIKE "Partial%"
AND "OfferingClass" = "standard"
AND "Unit" = "Quantity"
) AS "reserved1yPartialUpfrontLinuxQuantity",
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "1%"
AND "PurchaseOption" LIKE "Partial%"
AND "OfferingClass" = "standard"
AND "Unit" = "Hrs"
) AS "reserved1yPartialUpfrontLinuxHr",
/* Reserved 3Y partial upfront */
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "3%"
AND "PurchaseOption" LIKE "Partial%"
AND "OfferingClass" = "standard"
AND "Unit" = "Quantity"
) AS "reserved3yPartialUpfrontLinuxQuantity",
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "3%"
AND "PurchaseOption" LIKE "Partial%"
AND "OfferingClass" = "standard"
AND "Unit" = "Hrs"
) AS "reserved3yPartialUpfrontLinuxHr",
/* Reserved 1Y all upfront */
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "1%"
AND "PurchaseOption" LIKE "All%"
AND "OfferingClass" = "standard"
AND "Unit" = "Quantity"
) AS "reserved1yAllUpfrontLinuxQuantity",
/* Reserved 3Y all upfront */
(
SELECT "PricePerUnit"
FROM "us-east-1"
WHERE "Instance Type" = I."Instance Type"
AND "TermType" = "Reserved"
AND "Tenancy" = "Reserved"
AND "License Model" = "No License required"
AND "CapacityStatus" = "AllocatedHost"
AND "Operating System" = "Linux"
AND "Pre Installed S/W" = "NA"
AND "LeaseContractLength" LIKE "3%"
AND "PurchaseOption" LIKE "All%"
AND "OfferingClass" = "standard"
AND "Unit" = "Quantity"
) AS "reserved3yAllUpfrontLinuxQuantity"
FROM "us-east-1" I
WHERE ("Tenancy" = "Host" OR "Tenancy" = "Reserved")
AND ("TermType" = "OnDemand" OR "TermType" = "Reserved")
AND "CapacityStatus" LIKE "AllocatedHost"
GROUP BY "Instance Type"
ORDER BY "Instance Type";