data_sources
Creates, updates, deletes, gets or lists a data_sources resource.
Overview
| Name | data_sources |
| Type | Resource |
| Id | aws.appsync.data_sources |
Fields
The following fields are returned by SELECT queries:
- get_data_source
- list_data_sources
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the data source. (pattern: <code>[_A-Za-z][_0-9A-Za-z]*</code>) |
data_source_arn | string | The data source Amazon Resource Name (ARN). |
description | string | The description of the data source. |
dynamodb_config | object | Describes an Amazon DynamoDB data source configuration. |
elasticsearch_config | object | Describes 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_config | object | Describes an Amazon EventBridge bus data source configuration. |
http_config | object | Describes an HTTP data source configuration. |
lambda_config | object | Describes an Lambda data source configuration. |
metrics_config | string | Enables 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_config | object | Describes an OpenSearch data source configuration. |
relational_database_config | object | Describes a relational database data source configuration. |
service_role_arn | string | The 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_ | string | The 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) |
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the data source. (pattern: <code>[_A-Za-z][_0-9A-Za-z]*</code>) |
data_source_arn | string | The data source Amazon Resource Name (ARN). |
description | string | The description of the data source. |
dynamodb_config | object | Describes an Amazon DynamoDB data source configuration. |
elasticsearch_config | object | Describes 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_config | object | Describes an Amazon EventBridge bus data source configuration. |
http_config | object | Describes an HTTP data source configuration. |
lambda_config | object | Describes an Lambda data source configuration. |
metrics_config | string | Enables 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_config | object | Describes an OpenSearch data source configuration. |
relational_database_config | object | Describes a relational database data source configuration. |
service_role_arn | string | The 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_ | string | The 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_data_source | select | api_id, name, region | Retrieves a DataSource object. | |
list_data_sources | select | api_id, region | nextToken, maxResults | Lists the data sources for a given API. |
create_data_source | insert | api_id, region, name, type | Creates a DataSource object. | |
update_data_source | update | api_id, name, region, type | Updates a DataSource object. | |
delete_data_source | delete | api_id, name, region | Deletes a DataSource object. | |
start_data_source_introspection | exec | region | Creates 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.
| Name | Datatype | Description |
|---|---|---|
api_id | string | The API ID. |
name | string | The name of the data source. |
region | string | AWS region (default: us-east-1) |
maxResults | integer | The maximum number of results that you want the request to return. |
nextToken | string | An 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
- get_data_source
- list_data_sources
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
;
Lists the data sources for a given API.
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 region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
;
INSERT examples
- create_data_source
- Manifest
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
;
# Description fields are for documentation purposes
- name: data_sources
props:
- name: api_id
value: "{{ api_id }}"
description: Required parameter for the data_sources resource.
- name: region
value: "{{ region }}"
description: Required parameter for the data_sources resource.
- name: name
value: "{{ name }}"
- name: description
value: "{{ description }}"
- name: type
value: "{{ type }}"
valid_values: ['AWS_LAMBDA', 'AMAZON_DYNAMODB', 'AMAZON_ELASTICSEARCH', 'NONE', 'HTTP', 'RELATIONAL_DATABASE', 'AMAZON_OPENSEARCH_SERVICE', 'AMAZON_EVENTBRIDGE', 'AMAZON_BEDROCK_RUNTIME']
- name: serviceRoleArn
value: "{{ serviceRoleArn }}"
- name: dynamodbConfig
description: |
Describes an Amazon DynamoDB data source configuration.
value:
tableName: "{{ tableName }}"
awsRegion: "{{ awsRegion }}"
useCallerCredentials: {{ useCallerCredentials }}
deltaSyncConfig:
baseTableTTL: {{ baseTableTTL }}
deltaSyncTableName: "{{ deltaSyncTableName }}"
deltaSyncTableTTL: {{ deltaSyncTableTTL }}
versioned: {{ versioned }}
- name: lambdaConfig
description: |
Describes an Lambda data source configuration.
value:
lambdaFunctionArn: "{{ lambdaFunctionArn }}"
- name: elasticsearchConfig
description: |
Describes 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.
value:
endpoint: "{{ endpoint }}"
awsRegion: "{{ awsRegion }}"
- name: openSearchServiceConfig
description: |
Describes an OpenSearch data source configuration.
value:
endpoint: "{{ endpoint }}"
awsRegion: "{{ awsRegion }}"
- name: httpConfig
description: |
Describes an HTTP data source configuration.
value:
endpoint: "{{ endpoint }}"
authorizationConfig:
authorizationType: "{{ authorizationType }}"
awsIamConfig:
signingRegion: "{{ signingRegion }}"
signingServiceName: "{{ signingServiceName }}"
- name: relationalDatabaseConfig
description: |
Describes a relational database data source configuration.
value:
relationalDatabaseSourceType: "{{ relationalDatabaseSourceType }}"
rdsHttpEndpointConfig:
awsRegion: "{{ awsRegion }}"
dbClusterIdentifier: "{{ dbClusterIdentifier }}"
databaseName: "{{ databaseName }}"
schema: "{{ schema }}"
awsSecretStoreArn: "{{ awsSecretStoreArn }}"
- name: eventBridgeConfig
description: |
Describes an Amazon EventBridge bus data source configuration.
value:
eventBusArn: "{{ eventBusArn }}"
- name: metricsConfig
value: "{{ metricsConfig }}"
valid_values: ['ENABLED', 'DISABLED']
UPDATE examples
- update_data_source
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
- delete_data_source
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
- start_data_source_introspection
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 }}"
}'
;