---
title: "Create AWS on demand task"
method: POST
path: "/api/v2/agentless_scanning/ondemand/aws"
tags: ["Agentless Scanning"]
---

# Create AWS on demand task

`POST /api/v2/agentless_scanning/ondemand/aws`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/agentless_scanning/ondemand/aws`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `org_management`

Trigger the scan of an AWS resource with a high priority. Agentless scanning must be activated for the AWS account containing the resource to scan.

## Request body

- AwsOnDemandCreateRequest: Request object that includes the on demand task to submit.
  - `data` AwsOnDemandCreateData, required: Object for a single AWS on demand task.
    - `attributes` AwsOnDemandCreateAttributes, required: Attributes for the AWS on demand task.
      - `arn` string, required: The arn of the resource to scan. Agentless supports the scan of EC2 instances, lambda functions, AMI, ECR, RDS and S3 buckets.
    - `type` 'aws_resource', required: The type of the on demand task. The value should always be `aws_resource`.

## Response `201`

AWS on demand task created successfully.

- AwsOnDemandResponse: Response object that includes an AWS on demand task.
  - `data` AwsOnDemandData: Single AWS on demand task.
    - `attributes` AwsOnDemandAttributes: Attributes for the AWS on demand task.
      - `arn` string: The arn of the resource to scan.
      - `assigned_at` string: Specifies the assignment timestamp if the task has been already assigned to a scanner.
      - `created_at` string: The task submission timestamp.
      - `status` string: Indicates the status of the task. QUEUED: the task has been submitted successfully and the resource has not been assigned to a scanner yet. ASSIGNED: the task has been assigned. ABORTED: the scan has been aborted after a period of time due to technical reasons, such as resource not found, insufficient permissions, or the absence of a configured scanner.
    - `id` string: The UUID of the task.
    - `type` 'aws_resource': The type of the on demand task. The value should always be `aws_resource`.

## Other responses

- `400`: Bad Request
- `403`: Not Authorized
- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
