Menu
Amazon GuardDuty
Amazon Guard Duty User Guide

CreateDetector

Creates a single Amazon GuardDuty detector. A detector is an object that represents the GuardDuty service. You must create a detector to enable GuardDuty.

Important

Currently, GuardDuty supports only one detector resource per AWS account per region.

Request Syntax

POST https://<endpoint>/detector

Body:

{ "enable" : "boolean" }

Request Parameters

The request accepts the following data in JSON format.

enable

Specifies whether the detector is to be enabled.

Type: Boolean

Required: Yes

Response Syntax

Body:

{ "detectorId": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

detectorId

The unique ID of the created detector.

Type: String

Errors

If the action is not successful, the service sends back an HTTP error response code along with detailed error information.

InvalidInputException

The request is rejected. An invalid or out-of-range value is specified as an input parameter.

HTTP Status Code: 400

InvalidInputException

The request is rejected. The required query or path parameters are not specified.

HTTP Status Code: 400

InvalidInputException

The request is rejected. One or more input parameters have invalid values.

HTTP Status Code: 400

AccessDeniedException

The request is rejected. You do not have the required iam:CreateServiceLinkedRole permission.

HTTP Status Code: 400

LimitExceededException

The request is rejected. A detector already exists for the current account.

HTTP Status Code: 400

InternalException

Internal server error.

HTTP Status Code: 500

Example

Sample Request

POST /detector HTTP/1.1 Host: guardduty.us-west-2.amazonaws.com Accept-Encoding: identity Content-Length: 0 Authorization: AUTHPARAMS X-Amz-Date: 20180123T215330Z User-Agent: aws-cli/1.14.29 Python/2.7.9 Windows/8 botocore/1.8.33

Sample Response

HTTP/1.1 200 OK Content-Type: application/json Content-Length: 49 Date: Tue, 23 Jan 2018 21:53:32 GMT x-amzn-RequestId: da9e1c5b-0087-11e8-8012-7985c94ad5ec X-Amzn-Trace-Id: sampled=0;root=1-5a67aedc-76d97a5c367f2eac94d40825 X-Cache: Miss from cloudfront Via: 1.1 08df71188a92655a7dcd1bb872797741.cloudfront.net (CloudFront) X-Amz-Cf-Id: kYGX5j6wkW7fneZ8ee602vqpr3JCuQqBHyyMdpTwG9JV3u0ybcdaNQ== Connection: Keep-alive { "detectorId":"12abc34d567e8fa901bc2d34e56789f0" }