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
Idawscc.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_configobject
AWS 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

NameResourceAccessible byRequired Params
create_resourcedata_sourcesINSERTType, ApiId, Name, region
delete_resourcedata_sourcesDELETEIdentifier, region
update_resourcedata_sourcesUPDATEIdentifier, PatchDocument, region
list_resourcesdata_sources_list_onlySELECTregion
get_resourcedata_sourcesSELECTIdentifier, region

SELECT examples

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 awscc.appsync.data_sources
WHERE
region = '{{ region }}' AND
Identifier = '{{ data_source_arn }}';

INSERT example

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

/*+ create */
INSERT INTO awscc.appsync.data_sources (
ApiId,
Name,
Type,
region
)
SELECT
'{{ api_id }}',
'{{ name }}',
'{{ type }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

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

/*+ update */
UPDATE awscc.appsync.data_sources
SET PatchDocument = string('{{ {
"Description": description,
"DynamoDBConfig": dynamo_db_config,
"ElasticsearchConfig": elasticsearch_config,
"EventBridgeConfig": event_bridge_config,
"HttpConfig": http_config,
"LambdaConfig": lambda_config,
"OpenSearchServiceConfig": open_search_service_config,
"RelationalDatabaseConfig": relational_database_config,
"ServiceRoleArn": service_role_arn,
"Type": type,
"MetricsConfig": metrics_config
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ data_source_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.appsync.data_sources
WHERE
Identifier = '{{ data_source_arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

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

appsync:CreateDataSource,
appsync:GetDataSource,
iam:PassRole