Skip to main content

data_sources

Creates, updates, deletes, gets or lists a data_sources resource.

Overview

Namedata_sources
TypeResource
Idaws.opensearch.data_sources

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
data_source_typeobjectThe type of data source.
descriptionstringA description of the data source. (pattern: <code>^([a-zA-Z0-9_])[\a-zA-Z0-9_@#%+=:?./!\s-]*$</code>)
namestringThe name of the data source. (pattern: <code>[a-z][a-z0-9_]+</code>)
statusstringThe status of the data source. (ACTIVE, DISABLED)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_data_sourceselectdomain_name, data_source_name, regionRetrieves information about a direct query data source.
list_data_sourcesselectdomain_name, regionLists direct-query data sources for a specific domain. For more information, see For more information, see Working with Amazon OpenSearch Service direct queries with Amazon S3.
update_data_sourceupdatedomain_name, data_source_name, region, DataSourceTypeUpdates a direct-query data source. For more information, see Working with Amazon OpenSearch Service data source integrations with Amazon S3.
add_data_sourceupdatedomain_name, region, DataSourceTypeCreates a new direct-query data source to the specified domain. For more information, see Creating Amazon OpenSearch Service data source integrations with Amazon S3.
attach_data_sourceupdateid, region, dataSourceArnAttaches a data source to an OpenSearch application. The data source can be an Amazon OpenSearch Service domain or an Amazon OpenSearch Serverless collection. If both the application and data source are in the ACTIVE state, the attachment completes immediately and returns a status of ATTACHED. If either resource is not yet active, the operation stores the request and returns a status of PENDING. A background process then completes the attachment when both resources become active. Pending attachments that are not completed within 24 hours are marked as FAILED. This operation is idempotent. If a data source is already attached or pending for the same application, the existing attachment is returned.
delete_data_sourcedeletedomain_name, data_source_name, regionDeletes a direct-query data source. For more information, see Deleting an Amazon OpenSearch Service data source with Amazon S3.
detach_data_sourceexecid, region, dataSourceArnRemoves a data source from an OpenSearch application. The application must be in the ACTIVE state. This operation removes the data source saved object from the application and deletes the attachment record. Throws a ConflictException if the specified data source has a PENDING attachment, and a ResourceNotFoundException if the data source is not currently attached to the application.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
data_source_namestringThe name of the data source to delete.
domain_namestringThe name of the domain.
idstringThe unique identifier or name of the OpenSearch application to detach the data source from.
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves information about a direct query data source.

SELECT
data_source_type,
description,
name,
status
FROM aws.opensearch.data_sources
WHERE domain_name = '{{ domain_name }}' -- required
AND data_source_name = '{{ data_source_name }}' -- required
AND region = '{{ region }}' -- required
;

UPDATE examples

Updates a direct-query data source. For more information, see Working with Amazon OpenSearch Service data source integrations with Amazon S3.

UPDATE aws.opensearch.data_sources
SET
DataSourceType = '{{ DataSourceType }}',
Description = '{{ Description }}',
Status = '{{ Status }}'
WHERE
domain_name = '{{ domain_name }}' --required
AND data_source_name = '{{ data_source_name }}' --required
AND region = '{{ region }}' --required
AND DataSourceType = '{{ DataSourceType }}' --required
RETURNING
message;

DELETE examples

Deletes a direct-query data source. For more information, see Deleting an Amazon OpenSearch Service data source with Amazon S3.

DELETE FROM aws.opensearch.data_sources
WHERE domain_name = '{{ domain_name }}' --required
AND data_source_name = '{{ data_source_name }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Removes a data source from an OpenSearch application. The application must be in the ACTIVE state. This operation removes the data source saved object from the application and deletes the attachment record. Throws a ConflictException if the specified data source has a PENDING attachment, and a ResourceNotFoundException if the data source is not currently attached to the application.

EXEC aws.opensearch.data_sources.detach_data_source
@id='{{ id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"dataSourceArn": "{{ dataSourceArn }}"
}'
;