Skip to main content

data_sources

Creates, updates, deletes or gets a data_source resource or lists data_sources in a region

Overview

Namedata_sources
TypeResource
DescriptionResource Type definition for AWS::AppSync::DataSource
Idaws.appsync.data_sources

Fields

NameDatatypeDescription
api_idstringUnique AWS AppSync GraphQL API identifier where this data source will be created.
descriptionstringThe description of the data source.
dynamo_db_configobjectAWS Region and TableName for an Amazon DynamoDB table in your account.
elasticsearch_configobjectAWS Region and Endpoints for an Amazon OpenSearch Service domain in your account.
As of September 2021, Amazon Elasticsearch Service is Amazon OpenSearch Service. This property is deprecated. For new data sources, use OpenSearchServiceConfig to specify an OpenSearch Service data source.
event_bridge_configobjectARN for the EventBridge bus.
http_configobjectEndpoints for an HTTP data source.
lambda_configobjectAn ARN of a Lambda function in valid ARN format. This can be the ARN of a Lambda function that exists in the current account or in another account.
namestringFriendly name for you to identify your AppSync data source after creation.
open_search_service_configobjectAWS Region and Endpoints for an Amazon OpenSearch Service domain in your account.
relational_database_configobjectRelational Database configuration of the relational database data source.
service_role_arnstringThe AWS Identity and Access Management service role ARN for the data source. The system assumes this role when accessing the data source.
typestringThe type of the data source.
data_source_arnstringThe Amazon Resource Name (ARN) of the API key, such as arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid/datasources/datasourcename.
metrics_configstring
regionstringAWS region.

For more information, see AWS::AppSync::DataSource.

Methods

NameAccessible byRequired Params
create_resourceINSERTType, ApiId, Name, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all data_sources in a region.

SELECT
region,
api_id,
description,
dynamo_db_config,
elasticsearch_config,
event_bridge_config,
http_config,
lambda_config,
name,
open_search_service_config,
relational_database_config,
service_role_arn,
type,
data_source_arn,
metrics_config
FROM aws.appsync.data_sources
WHERE region = 'us-east-1';

Gets all properties from an individual data_source.

SELECT
region,
api_id,
description,
dynamo_db_config,
elasticsearch_config,
event_bridge_config,
http_config,
lambda_config,
name,
open_search_service_config,
relational_database_config,
service_role_arn,
type,
data_source_arn,
metrics_config
FROM aws.appsync.data_sources
WHERE region = 'us-east-1' AND data__Identifier = '<DataSourceArn>';

INSERT example

Use the following StackQL query and manifest file to create a new data_source resource, using stack-deploy.

/*+ create */
INSERT INTO aws.appsync.data_sources (
ApiId,
Name,
Type,
region
)
SELECT
'{{ ApiId }}',
'{{ Name }}',
'{{ Type }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.appsync.data_sources
WHERE data__Identifier = '<DataSourceArn>'
AND region = 'us-east-1';

Permissions

To operate on the data_sources resource, the following permissions are required:

Create

appsync:CreateDataSource,
appsync:GetDataSource,
iam:PassRole

Read

appsync:GetDataSource

Update

appsync:UpdateDataSource,
iam:PassRole

Delete

appsync:DeleteDataSource,
appsync:GetDataSource

List

appsync:ListDataSources