start_query
async
¶
start_query(
*,
config_overrides: Optional[AsyncCloudTrailClientConfig] = None,
query_statement: Optional[QueryStatement] = None,
delivery_s3_uri: Optional[DeliveryS3Uri] = None,
query_alias: Optional[QueryAlias] = None,
query_parameters: Optional[QueryParameters] = None,
event_data_store_owner_account_id: Optional[AccountId] = None,
) -> StartQueryResponse
CloudTrail Lake will no longer be open to new customers starting May 31, 2026. If you would like to use CloudTrail Lake, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see CloudTrail Lake availability change.
Starts a CloudTrail Lake query. Use the QueryStatement parameter to provide your SQL query, enclosed in single quotation marks. Use the optional DeliveryS3Uri parameter to deliver the query results to an S3 bucket.
StartQuery requires you specify either the QueryStatement parameter, or a QueryAlias and any QueryParameters. In the current release, the QueryAlias and QueryParameters parameters are used only for the queries that populate the CloudTrail Lake dashboards.
Parameters:
-
query_statement(Optional[QueryStatement], default:None) –The SQL code of your query.
-
delivery_s3_uri(Optional[DeliveryS3Uri], default:None) –The URI for the S3 bucket where CloudTrail delivers the query results.
-
query_alias(Optional[QueryAlias], default:None) –The alias that identifies a query template.
-
query_parameters(Optional[QueryParameters], default:None) –The query parameters for the specified
QueryAlias. -
event_data_store_owner_account_id(Optional[AccountId], default:None) –The account ID of the event data store owner.
Raises:
-
EventDataStoreARNInvalidException–The specified event data store ARN is not valid or does not map to an event data store in your account.
-
EventDataStoreNotFoundException–The specified event data store was not found.
-
InactiveEventDataStoreException–The event data store is inactive.
-
InsufficientEncryptionPolicyException–For the
CreateTrailPutInsightSelectors,UpdateTrail,StartQuery, andStartImportoperations, this exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.For all other operations, this exception is thrown when the policy for the KMS key does not have sufficient permissions for the operation.
-
InsufficientS3BucketPolicyException–This exception is thrown when the policy on the S3 bucket is not sufficient.
-
InvalidParameterException–The request includes a parameter that is not valid.
-
InvalidQueryStatementException–The query that was submitted has validation errors, or uses incorrect syntax or unsupported keywords. For more information about writing a query, see Create or edit a query in the CloudTrail User Guide.
-
InvalidS3BucketNameException–This exception is thrown when the provided S3 bucket name is not valid.
-
InvalidS3PrefixException–This exception is thrown when the provided S3 prefix is not valid.
-
MaxConcurrentQueriesException–You are already running the maximum number of concurrent queries. The maximum number of concurrent queries is 10. Wait a minute for some queries to finish, and then run the query again.
-
NoManagementAccountSLRExistsException–This exception is thrown when the management account does not have a service-linked role.
-
OperationNotPermittedException–This exception is thrown when the requested operation is not permitted.
-
S3BucketDoesNotExistException–This exception is thrown when the specified S3 bucket does not exist.
-
UnsupportedOperationException–This exception is thrown when the requested operation is not supported.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cloudtrail/_services/async_cloud_trail.py
4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 | |