For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/es/api/latest/fleet-automation/upgrade-hosts.md. A documentation index is available at /llms.txt.
Language
Datadog site

Upgrade hosts

POSThttps://api.datadoghq.com/api/v2/fleet/deployments/upgradehttps://api.us3.datadoghq.com/api/v2/fleet/deployments/upgradehttps://api.us5.datadoghq.com/api/v2/fleet/deployments/upgradehttps://api.datadoghq.eu/api/v2/fleet/deployments/upgradehttps://api.ap1.datadoghq.com/api/v2/fleet/deployments/upgradehttps://api.ap2.datadoghq.com/api/v2/fleet/deployments/upgradehttps://api.uk1.datadoghq.com/api/v2/fleet/deployments/upgradehttps://api.ddog-gov.com/api/v2/fleet/deployments/upgradehttps://api.us2.ddog-gov.com/api/v2/fleet/deployments/upgrade

Descripción general

Create and immediately start a new package upgrade on hosts matching the specified filter query.

This endpoint allows you to upgrade the Datadog Agent to a specific version on hosts matching the specified filter query.

The deployment is created and started automatically. The system:

  1. Identifies all hosts matching the filter query.
  2. Validates that the specified version is available.
  3. Begins rolling out the package upgrade to the target hosts.

Returns a 400 if filter_query or target_packages is missing, a target package is missing a name or version, or the filter query does not match any host eligible for the upgrade. Returns a 409 if a conflicting upgrade is already running on one or more target hosts.

This endpoint requires all of the following permissions:

  • agent_upgrade_write
  • fleet_policies_write

Solicitud

Body Data (required)

Request payload containing the package upgrade details.

Campo
Type
Descripción
data [required]
object

Data for creating a new v2 package upgrade deployment.

Respuesta

CREATED

Response containing the newly created deployment.

Campo
Type
Descripción
data [required]
object

A deployment in the v2 API response.

Ejemplo de código

Upgrade hosts
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/fleet/deployments/upgrade" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "filter_query": "env:prod AND service:web",
      "target_packages": [
        {
          "name": "datadog-agent",
          "version": "7.52.0"
        }
      ]
    },
    "type": "deployment"
  }
}
EOF