StartTopicsDetectionJobCommand

Starts an asynchronous topic detection job. Use the DescribeTopicDetectionJob operation to track the status of a job.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ComprehendClient, StartTopicsDetectionJobCommand } from "@aws-sdk/client-comprehend"; // ES Modules import
// const { ComprehendClient, StartTopicsDetectionJobCommand } = require("@aws-sdk/client-comprehend"); // CommonJS import
const client = new ComprehendClient(config);
const input = { // StartTopicsDetectionJobRequest
  InputDataConfig: { // InputDataConfig
    S3Uri: "STRING_VALUE", // required
    InputFormat: "ONE_DOC_PER_FILE" || "ONE_DOC_PER_LINE",
    DocumentReaderConfig: { // DocumentReaderConfig
      DocumentReadAction: "TEXTRACT_DETECT_DOCUMENT_TEXT" || "TEXTRACT_ANALYZE_DOCUMENT", // required
      DocumentReadMode: "SERVICE_DEFAULT" || "FORCE_DOCUMENT_READ_ACTION",
      FeatureTypes: [ // ListOfDocumentReadFeatureTypes
        "TABLES" || "FORMS",
      ],
    },
  },
  OutputDataConfig: { // OutputDataConfig
    S3Uri: "STRING_VALUE", // required
    KmsKeyId: "STRING_VALUE",
  },
  DataAccessRoleArn: "STRING_VALUE", // required
  JobName: "STRING_VALUE",
  NumberOfTopics: Number("int"),
  ClientRequestToken: "STRING_VALUE",
  VolumeKmsKeyId: "STRING_VALUE",
  VpcConfig: { // VpcConfig
    SecurityGroupIds: [ // SecurityGroupIds // required
      "STRING_VALUE",
    ],
    Subnets: [ // Subnets // required
      "STRING_VALUE",
    ],
  },
  Tags: [ // TagList
    { // Tag
      Key: "STRING_VALUE", // required
      Value: "STRING_VALUE",
    },
  ],
};
const command = new StartTopicsDetectionJobCommand(input);
const response = await client.send(command);
// { // StartTopicsDetectionJobResponse
//   JobId: "STRING_VALUE",
//   JobArn: "STRING_VALUE",
//   JobStatus: "SUBMITTED" || "IN_PROGRESS" || "COMPLETED" || "FAILED" || "STOP_REQUESTED" || "STOPPED",
// };

StartTopicsDetectionJobCommand Input

Parameter
Type
Description
DataAccessRoleArn
Required
string | undefined

The Amazon Resource Name (ARN) of the IAM role that grants Amazon Comprehend read access to your input data. For more information, see Role-based permissions .

InputDataConfig
Required
InputDataConfig | undefined

Specifies the format and location of the input data for the job.

OutputDataConfig
Required
OutputDataConfig | undefined

Specifies where to send the output files. The output is a compressed archive with two files, topic-terms.csv that lists the terms associated with each topic, and doc-topics.csv that lists the documents associated with each topic

ClientRequestToken
string | undefined

A unique identifier for the request. If you do not set the client request token, Amazon Comprehend generates one.

JobName
string | undefined

The identifier of the job.

NumberOfTopics
number | undefined

The number of topics to detect.

Tags
Tag[] | undefined

Tags to associate with the topics detection job. A tag is a key-value pair that adds metadata to a resource used by Amazon Comprehend. For example, a tag with "Sales" as the key might be added to a resource to indicate its use by the sales department.

VolumeKmsKeyId
string | undefined

ID for the Amazon Web Services Key Management Service (KMS) key that Amazon Comprehend uses to encrypt data on the storage volume attached to the ML compute instance(s) that process the analysis job. The VolumeKmsKeyId can be either of the following formats:

  • KMS Key ID: "1234abcd-12ab-34cd-56ef-1234567890ab"

  • Amazon Resource Name (ARN) of a KMS Key: "arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"

VpcConfig
VpcConfig | undefined

Configuration parameters for an optional private Virtual Private Cloud (VPC) containing the resources you are using for your topic detection job. For more information, see Amazon VPC .

StartTopicsDetectionJobCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
JobArn
string | undefined

The Amazon Resource Name (ARN) of the topics detection job. It is a unique, fully qualified identifier for the job. It includes the Amazon Web Services account, Amazon Web Services Region, and the job ID. The format of the ARN is as follows:

arn::comprehend:::topics-detection-job/

The following is an example job ARN:

arn:aws:comprehend:us-west-2:111122223333:document-classification-job/1234abcd12ab34cd56ef1234567890ab

JobId
string | undefined

The identifier generated for the job. To get the status of the job, use this identifier with the DescribeTopicDetectionJob operation.

JobStatus
JobStatus | undefined

The status of the job:

  • SUBMITTED - The job has been received and is queued for processing.

  • IN_PROGRESS - Amazon Comprehend is processing the job.

  • COMPLETED - The job was successfully completed and the output is available.

  • FAILED - The job did not complete. To get details, use the DescribeTopicDetectionJob operation.

Throws

Name
Fault
Details
InternalServerException
server

An internal server error occurred. Retry your request.

InvalidRequestException
client

The request is invalid.

KmsKeyValidationException
client

The KMS customer managed key (CMK) entered cannot be validated. Verify the key and re-enter it.

ResourceInUseException
client

The specified resource name is already in use. Use a different name and try your request again.

TooManyRequestsException
client

The number of requests exceeds the limit. Resubmit your request later.

TooManyTagsException
client

The request contains more tags than can be associated with a resource (50 tags per resource). The maximum number of tags includes both existing tags and those included in your current request.

ComprehendServiceException
Base exception class for all service exceptions from Comprehend service.