Skip to content

Generate Query

cloudtrail_generate_query R Documentation

Generates a query from a natural language prompt

Description

Generates a query from a natural language prompt. This operation uses generative artificial intelligence (generative AI) to produce a ready-to-use SQL query from the prompt.

The prompt can be a question or a statement about the event data in your event data store. For example, you can enter prompts like "What are my top errors in the past month?" and “Give me a list of users that used SNS.”

The prompt must be in English. For information about limitations, permissions, and supported Regions, see Create CloudTrail Lake queries from natural language prompts in the CloudTrail user guide.

Do not include any personally identifying, confidential, or sensitive information in your prompts.

This feature uses generative AI large language models (LLMs); we recommend double-checking the LLM response.

Usage

cloudtrail_generate_query(EventDataStores, Prompt)

Arguments

EventDataStores

[required] The ARN (or ID suffix of the ARN) of the event data store that you want to query. You can only specify one event data store.

Prompt

[required] The prompt that you want to use to generate the query. The prompt must be in English. For example prompts, see Example prompts in the CloudTrail user guide.

Value

A list with the following syntax:

list(
  QueryStatement = "string",
  QueryAlias = "string",
  EventDataStoreOwnerAccountId = "string"
)

Request syntax

svc$generate_query(
  EventDataStores = list(
    "string"
  ),
  Prompt = "string"
)