Reference
What a new reservation or Savings Plan would cost and save
Quotes one purchase the organization does not hold yet, a NewPurchase with an optional lookback_days of 30 or 60. basis is usage when the buying account's payer already runs the target: a reservation is replayed over its family's daily on-demand hours in units of the class bought and priced at the on-demand rate measured on the bill; a plan is replayed at the organization's own rates, as GET /purchase-simulation does, on any term and payment AWS sells it on. Otherwise basis is full_use: every hour used, against the price list's on-demand rate where it has one, and at face (no saving) where it has none, which is always the case for a plan. upfront, recurring_monthly, commitment_monthly and term_total are the offering's list price; over_automation_cap says Automated Savings would refuse the term total. A reservation quoted on usage also answers unused_units and left_on_demand_units, what it leaves unused and on demand an hour in reservations of the class bought. The offering is the one named, or the cheapest sold on those terms. A plan quoted without an offering_id is priced on its commitment, term and payment option without reading the catalogue, and its offering_id is null. 422 when AWS sells nothing on those terms, and for a Database plan other than 12 months No Upfront; 502 when every connected account refused the offerings lookup. Buys nothing.
Authorization
BearerAuth In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/v1/commitments/purchase-simulation" \ -H "Content-Type: application/json" \ -d '{ "kind": "reserved_instance", "service": "ec2", "region": "string", "resource": "string", "quantity": 1, "term_months": 12, "payment_option": "no_upfront", "buying_account_id": "string" }'{
"success": true,
"timestamp": "2019-08-24T14:15:22Z",
"data": {
"basis": "usage",
"offering_id": "string",
"currency": "string",
"term_months": 0,
"payment_option": "string",
"upfront": 0,
"recurring_monthly": 0,
"commitment_monthly": 0,
"term_total": 0,
"covered_on_demand_monthly": 0,
"left_on_demand_monthly": 0,
"unused_monthly": 0,
"unused_units": 0,
"left_on_demand_units": 0,
"net_savings_monthly": 0,
"savings_pct": 0,
"coverage_before_pct": 0,
"coverage_after_pct": 0,
"utilization_pct": 0,
"break_even_months": 0,
"capacity": 0,
"over_automation_cap": true,
"pool": {
"window": {
"first_day": "2019-08-24",
"last_day": "2019-08-24",
"days": 0,
"missing_days": 0,
"last_loaded": "2019-08-24"
},
"recommended": 0,
"recommended_capacity": 0,
"already_covered_monthly": 0,
"agreed_hourly": 0
},
"series": [
{
"day": "2019-08-24",
"used": 0
}
]
}
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}{
"success": false,
"error": {
"code": "string",
"message": "string",
"details": null
},
"timestamp": "2019-08-24T14:15:22Z"
}Cancel a purchase before it is sent to AWS POST
Stops a purchase that has not been sent to AWS: it is rejected, reads cancelled_before_purchase, and stays that way, so it cannot be accepted or released again; raise a new purchase to buy it. An organization admin or the member who raised or requested it may cancel. Calling it again changes nothing. 409 purchase_already_sent once a purchase was sent and may have been bought, purchase_closed for one already bought or rejected, and purchase_bought_by_hand for one released to be bought by hand, which may already be bought. 404 for an id that is no purchase.
Raise a Reserved Instance or Savings Plan purchase POST
Raises a purchase as a savings recommendation, BUY- followed by a number. Nothing is bought until an organization admin releases it, so a member may raise one, and so may a read-write API key. A body naming kind is a NewPurchase: a reservation (service, region, class, quantity) or a Savings Plan of any type (commitment_hourly, and for an EC2 Instance plan its instance_family and region), on a 12 or 36 month term and any payment option. offering_id is required: it is looked up again in AWS and refused with 409 once AWS no longer sells it. buying_account_id must be an AWS account of the organization (422 otherwise). monthly_savings is the quote's net savings when it was replayed over measured usage, and 0 when it assumes every hour is used. Calling it again for the same target returns the undecided purchase when it names the same pick. Any other pick is answered 409 undecided_purchase_exists with that purchase's recommendation_id, state, raised_by and raised_at, and confirm_additional true raises a second one beside it. draft true raises a purchase before anybody asks for a decision on it, so an access grant can be minted for its id. A draft is its raiser's alone: it is left out of every savings list and total, it is never the purchase already raised for its target, and it becomes an ordinary purchase the moment it is accepted or an execution request is filed for it. It expires at draft_expires_at, which is renewed when it is re-sized and moved to its access grant's end when that is later, and an expired draft is refused with 409 purchase_draft_expired wherever it is acted on. Raising a draft again for the same target and buying account returns the caller's own draft, re-sized to the new pick with rebound true, so it keeps its id and its grant. Another person's draft is never returned and never refuses a raise, so accepting a draft or filing its execution request asks again what a raise asks: 409 schedule_exists, same_purchase_exists or undecided_purchase_exists, the last two unless the draft was raised again with confirm_additional true. A draft takes a signed-in caller and a body naming kind (422 otherwise). A body without kind raises one payer's /purchase-plan proposal for a 12 month No Upfront plan, as before. profile picks a sized profile (balanced when neither is named), or commitment_hourly names a size of the caller's own, rounded down to $0.001 and refused above AWS's cap. Calling it again returns the purchase nobody has decided yet for that payer and plan type when it is bound to the same pick, and refuses any other pick with 409: PATCH /purchase/{recommendation_id} changes it. Also 409 when the proposal carries no size, when AWS's own recommendation was not fetched in the last 7 days, or when the size is under $0.001 an hour. payer_account_id may be omitted when the organization has one payer (422 otherwise; 404 for a payer that bills nothing). monthly_savings is the lower of the daily replay and AWS's estimate scaled to this size, both at the organization's own rates. attempt_id names one attempt at a purchase: sending the same attempt_id again, after a second click, a reload or a retry, returns the purchase that attempt raised with created false, and a different request under an attempt_id already used is refused with 422. A new attempt identical to a purchase awaiting approval, accepted, released, or sent to AWS in the last 24 hours is answered 409 same_purchase_exists with that purchase's recommendation_id, state, raised_by and raised_at; send it again with confirm_additional true to raise a second one. Any other difference, a quantity or a commitment for one, raises as usual. Either way, when the buying account is connected the row carries both implementation tags and an access policy that can only buy this one purchase, so Automated Savings can buy it; otherwise it is delivered by hand (Manual Setup) with no access policy. It bills only once AWS reports it active.