Replace Container Instance Deletion Cost
curl --request PUT \
--url http://169.254.169.254/v1/deletion-cost \
--header 'Content-Type: application/json' \
--header 'Metadata: <metadata>' \
--data '
{
"deletion_cost": -1
}
'import requests
url = "http://169.254.169.254/v1/deletion-cost"
payload = { "deletion_cost": -1 }
headers = {
"Metadata": "<metadata>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Metadata: '<metadata>', 'Content-Type': 'application/json'},
body: JSON.stringify({deletion_cost: -1})
};
fetch('http://169.254.169.254/v1/deletion-cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://169.254.169.254/v1/deletion-cost",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'deletion_cost' => -1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Metadata: <metadata>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://169.254.169.254/v1/deletion-cost"
payload := strings.NewReader("{\n \"deletion_cost\": -1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Metadata", "<metadata>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("http://169.254.169.254/v1/deletion-cost")
.header("Metadata", "<metadata>")
.header("Content-Type", "application/json")
.body("{\n \"deletion_cost\": -1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://169.254.169.254/v1/deletion-cost")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Metadata"] = '<metadata>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deletion_cost\": -1\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}Instance Metadata Service
Replace Container Instance Deletion Cost
Replaces the deletion cost of the current container instance
PUT
/
v1
/
deletion-cost
Replace Container Instance Deletion Cost
curl --request PUT \
--url http://169.254.169.254/v1/deletion-cost \
--header 'Content-Type: application/json' \
--header 'Metadata: <metadata>' \
--data '
{
"deletion_cost": -1
}
'import requests
url = "http://169.254.169.254/v1/deletion-cost"
payload = { "deletion_cost": -1 }
headers = {
"Metadata": "<metadata>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Metadata: '<metadata>', 'Content-Type': 'application/json'},
body: JSON.stringify({deletion_cost: -1})
};
fetch('http://169.254.169.254/v1/deletion-cost', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://169.254.169.254/v1/deletion-cost",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'deletion_cost' => -1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Metadata: <metadata>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://169.254.169.254/v1/deletion-cost"
payload := strings.NewReader("{\n \"deletion_cost\": -1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Metadata", "<metadata>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("http://169.254.169.254/v1/deletion-cost")
.header("Metadata", "<metadata>")
.header("Content-Type", "application/json")
.body("{\n \"deletion_cost\": -1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://169.254.169.254/v1/deletion-cost")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Metadata"] = '<metadata>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"deletion_cost\": -1\n}"
response = http.request(request)
puts response.read_body{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}{
"code": "<string>",
"detail": "<string>",
"errors": {},
"instance": "<string>",
"status": 349,
"title": "<string>",
"type": "about:blank"
}Last Updated: May 10, 2025
Headers
A custom request header required by all operations.
Allowed value:
"true"Body
application/json
The deletion cost of the current container instance.
An integer value that identifies the relative cost to the application running across the container group if the current container instance is deleted. A higher value indicates a higher cost, and a lower value indicates a lower cost. If the container group is scaled down, the scheduler will attempt to delete the container instances with the lowest deletion costs first.
Required range:
-2147483648 <= x <= 2147483647Example:
100
Response
No Content
Was this page helpful?
⌘I