start_query
¶
start_query(
*,
config_overrides: Optional[CloudTrailClientConfig] = 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/cloud_trail.py
3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 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 | |