data_sources
Creates, updates, deletes, gets or lists a data_sources resource.
Overview
| Name | data_sources |
| Type | Resource |
| Id | aws.opensearch.data_sources |
Fields
The following fields are returned by SELECT queries:
- get_data_source
- list_data_sources
| Name | Datatype | Description |
|---|---|---|
data_source_type | object | The type of data source. |
description | string | A description of the data source. (pattern: <code>^([a-zA-Z0-9_])[\a-zA-Z0-9_@#%+=:?./!\s-]*$</code>) |
name | string | The name of the data source. (pattern: <code>[a-z][a-z0-9_]+</code>) |
status | string | The status of the data source. (ACTIVE, DISABLED) |
| Name | Datatype | Description |
|---|---|---|
data_sources | array | A list of data sources associated with specified domain. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_data_source | select | domain_name, data_source_name, region | Retrieves information about a direct query data source. | |
list_data_sources | select | domain_name, region | Lists 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_source | update | domain_name, data_source_name, region, DataSourceType | Updates a direct-query data source. For more information, see Working with Amazon OpenSearch Service data source integrations with Amazon S3. | |
add_data_source | update | domain_name, region, DataSourceType | Creates 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_source | update | id, region, dataSourceArn | Attaches 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_source | delete | domain_name, data_source_name, region | Deletes a direct-query data source. For more information, see Deleting an Amazon OpenSearch Service data source with Amazon S3. | |
detach_data_source | exec | id, region, dataSourceArn | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
data_source_name | string | The name of the data source to delete. |
domain_name | string | The name of the domain. |
id | string | The unique identifier or name of the OpenSearch application to detach the data source from. |
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_data_source
- list_data_sources
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
;
Lists 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.
SELECT
data_sources
FROM aws.opensearch.data_sources
WHERE domain_name = '{{ domain_name }}' -- required
AND region = '{{ region }}' -- required
;
UPDATE examples
- update_data_source
- add_data_source
- attach_data_source
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;
Creates a new direct-query data source to the specified domain. For more information, see Creating Amazon OpenSearch Service data source integrations with Amazon S3.
UPDATE aws.opensearch.data_sources
SET
Name = '{{ Name }}',
DataSourceType = '{{ DataSourceType }}',
Description = '{{ Description }}'
WHERE
domain_name = '{{ domain_name }}' --required
AND region = '{{ region }}' --required
AND DataSourceType = '{{ DataSourceType }}' --required
RETURNING
message;
Attaches 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.
UPDATE aws.opensearch.data_sources
SET
dataSourceArn = '{{ dataSourceArn }}',
workspaceId = '{{ workspaceId }}',
workspaceConfiguration = '{{ workspaceConfiguration }}',
clientToken = '{{ clientToken }}'
WHERE
id = '{{ id }}' --required
AND region = '{{ region }}' --required
AND dataSourceArn = '{{ dataSourceArn }}' --required
RETURNING
id,
arn,
attachment_id,
data_source_arn,
status;
DELETE examples
- delete_data_source
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
- detach_data_source
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 }}"
}'
;