Skip to main content

data_sources

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

Overview

Namedata_sources
TypeResource
Idaws.appsync.data_sources

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the data source. (pattern: <code>[_A-Za-z][_0-9A-Za-z]*</code>)
data_source_arnstringThe data source Amazon Resource Name (ARN).
descriptionstringThe description of the data source.
dynamodb_configobjectDescribes an Amazon DynamoDB data source configuration.
elasticsearch_configobjectDescribes an OpenSearch data source configuration. As of September 2021, Amazon Elasticsearch service is Amazon OpenSearch Service. This configuration is deprecated. For new data sources, use OpenSearchServiceDataSourceConfig to specify an OpenSearch data source.
event_bridge_configobjectDescribes an Amazon EventBridge bus data source configuration.
http_configobjectDescribes an HTTP data source configuration.
lambda_configobjectDescribes an Lambda data source configuration.
metrics_configstringEnables or disables enhanced data source metrics for specified data sources. Note that metricsConfig won't be used unless the dataSourceLevelMetricsBehavior value is set to PER_DATA_SOURCE_METRICS. If the dataSourceLevelMetricsBehavior is set to FULL_REQUEST_DATA_SOURCE_METRICS instead, metricsConfig will be ignored. However, you can still set its value. metricsConfig can be ENABLED or DISABLED. (ENABLED, DISABLED)
open_search_service_configobjectDescribes an OpenSearch data source configuration.
relational_database_configobjectDescribes a relational database data source configuration.
service_role_arnstringThe Identity and Access Management (IAM) service role Amazon Resource Name (ARN) for the data source. The system assumes this role when accessing the data source.
type_stringThe type of the data source. AWS_LAMBDA: The data source is an Lambda function. AMAZON_DYNAMODB: The data source is an Amazon DynamoDB table. AMAZON_ELASTICSEARCH: The data source is an Amazon OpenSearch Service domain. AMAZON_OPENSEARCH_SERVICE: The data source is an Amazon OpenSearch Service domain. AMAZON_EVENTBRIDGE: The data source is an Amazon EventBridge configuration. AMAZON_BEDROCK_RUNTIME: The data source is the Amazon Bedrock runtime. NONE: There is no data source. Use this type when you want to invoke a GraphQL operation without connecting to a data source, such as when you're performing data transformation with resolvers or invoking a subscription from a mutation. HTTP: The data source is an HTTP endpoint. RELATIONAL_DATABASE: The data source is a relational database. (AWS_LAMBDA, AMAZON_DYNAMODB, AMAZON_ELASTICSEARCH, NONE, HTTP, RELATIONAL_DATABASE, AMAZON_OPENSEARCH_SERVICE, AMAZON_EVENTBRIDGE, AMAZON_BEDROCK_RUNTIME)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_data_sourceselectapi_id, name, regionRetrieves a DataSource object.
list_data_sourcesselectapi_id, regionnextToken, maxResultsLists the data sources for a given API.
create_data_sourceinsertapi_id, region, name, typeCreates a DataSource object.
update_data_sourceupdateapi_id, name, region, typeUpdates a DataSource object.
delete_data_sourcedeleteapi_id, name, regionDeletes a DataSource object.
start_data_source_introspectionexecregionCreates a new introspection. Returns the introspectionId of the new introspection after its creation.

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
api_idstringThe API ID.
namestringThe name of the data source.
regionstringAWS region (default: us-east-1)
maxResultsintegerThe maximum number of results that you want the request to return.
nextTokenstringAn identifier that was returned from the previous call to this operation, which you can use to return the next set of items in the list.

SELECT examples

Retrieves a DataSource object.

SELECT
name,
data_source_arn,
description,
dynamodb_config,
elasticsearch_config,
event_bridge_config,
http_config,
lambda_config,
metrics_config,
open_search_service_config,
relational_database_config,
service_role_arn,
type_
FROM aws.appsync.data_sources
WHERE api_id = '{{ api_id }}' -- required
AND name = '{{ name }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a DataSource object.

INSERT INTO aws.appsync.data_sources (
name,
description,
type,
serviceRoleArn,
dynamodbConfig,
lambdaConfig,
elasticsearchConfig,
openSearchServiceConfig,
httpConfig,
relationalDatabaseConfig,
eventBridgeConfig,
metricsConfig,
api_id,
region
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ type }}' /* required */,
'{{ serviceRoleArn }}',
'{{ dynamodbConfig }}',
'{{ lambdaConfig }}',
'{{ elasticsearchConfig }}',
'{{ openSearchServiceConfig }}',
'{{ httpConfig }}',
'{{ relationalDatabaseConfig }}',
'{{ eventBridgeConfig }}',
'{{ metricsConfig }}',
'{{ api_id }}',
'{{ region }}'
RETURNING
data_source
;

UPDATE examples

Updates a DataSource object.

UPDATE aws.appsync.data_sources
SET
description = '{{ description }}',
type = '{{ type }}',
serviceRoleArn = '{{ serviceRoleArn }}',
dynamodbConfig = '{{ dynamodbConfig }}',
lambdaConfig = '{{ lambdaConfig }}',
elasticsearchConfig = '{{ elasticsearchConfig }}',
openSearchServiceConfig = '{{ openSearchServiceConfig }}',
httpConfig = '{{ httpConfig }}',
relationalDatabaseConfig = '{{ relationalDatabaseConfig }}',
eventBridgeConfig = '{{ eventBridgeConfig }}',
metricsConfig = '{{ metricsConfig }}'
WHERE
api_id = '{{ api_id }}' --required
AND name = '{{ name }}' --required
AND region = '{{ region }}' --required
AND type = '{{ type }}' --required
RETURNING
data_source;

DELETE examples

Deletes a DataSource object.

DELETE FROM aws.appsync.data_sources
WHERE api_id = '{{ api_id }}' --required
AND name = '{{ name }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Creates a new introspection. Returns the introspectionId of the new introspection after its creation.

EXEC aws.appsync.data_sources.start_data_source_introspection
@region='{{ region }}' --required
@@json=
'{
"rdsDataApiConfig": "{{ rdsDataApiConfig }}"
}'
;