data_sources
Creates, updates, deletes or gets a data_source resource or lists data_sources in a region
Overview
| Name | data_sources |
| Type | Resource |
| Description | Resource Type definition for AWS::AppSync::DataSource |
| Id | awscc.appsync.data_sources |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
api_id | string | Unique AWS AppSync GraphQL API identifier where this data source will be created. |
description | string | The description of the data source. |
dynamo_db_config | object | AWS Region and TableName for an Amazon DynamoDB table in your account. |
elasticsearch_config | object | AWS Region and Endpoints for an Amazon OpenSearch Service domain in your account.<br />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_config | object | ARN for the EventBridge bus. |
http_config | object | Endpoints for an HTTP data source. |
lambda_config | object | An 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. |
name | string | Friendly name for you to identify your AppSync data source after creation. |
open_search_service_config | object | AWS Region and Endpoints for an Amazon OpenSearch Service domain in your account. |
relational_database_config | object | Relational Database configuration of the relational database data source. |
service_role_arn | string | The AWS Identity and Access Management service role ARN for the data source. The system assumes this role when accessing the data source. |
type | string | The type of the data source. |
data_source_arn | string | The Amazon Resource Name (ARN) of the API key, such as arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid/datasources/datasourcename. |
metrics_config | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
data_source_arn | string | The Amazon Resource Name (ARN) of the API key, such as arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid/datasources/datasourcename. |
region | string | AWS region. |
For more information, see AWS::AppSync::DataSource.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | data_sources | INSERT | Type, ApiId, Name, region |
delete_resource | data_sources | DELETE | Identifier, region |
update_resource | data_sources | UPDATE | Identifier, PatchDocument, region |
list_resources | data_sources_list_only | SELECT | region |
get_resource | data_sources | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = 'us-east-1' AND
Identifier = '{{ data_source_arn }}';
Lists all data_sources in a region.
SELECT
region,
data_source_arn
FROM awscc.appsync.data_sources_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new data_source resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.appsync.data_sources (
ApiId,
Name,
Type,
region
)
SELECT
'{{ api_id }}',
'{{ name }}',
'{{ type }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.appsync.data_sources (
ApiId,
Description,
DynamoDBConfig,
ElasticsearchConfig,
EventBridgeConfig,
HttpConfig,
LambdaConfig,
Name,
OpenSearchServiceConfig,
RelationalDatabaseConfig,
ServiceRoleArn,
Type,
MetricsConfig,
region
)
SELECT
'{{ 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 }}',
'{{ metrics_config }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: data_source
props:
- name: api_id
value: '{{ api_id }}'
- name: description
value: '{{ description }}'
- name: dynamo_db_config
value:
table_name: '{{ table_name }}'
delta_sync_config:
base_table_ttl: '{{ base_table_ttl }}'
delta_sync_table_ttl: '{{ delta_sync_table_ttl }}'
delta_sync_table_name: '{{ delta_sync_table_name }}'
use_caller_credentials: '{{ use_caller_credentials }}'
aws_region: '{{ aws_region }}'
versioned: '{{ versioned }}'
- name: elasticsearch_config
value:
aws_region: '{{ aws_region }}'
endpoint: '{{ endpoint }}'
- name: event_bridge_config
value:
event_bus_arn: '{{ event_bus_arn }}'
- name: http_config
value:
endpoint: '{{ endpoint }}'
authorization_config:
authorization_type: '{{ authorization_type }}'
aws_iam_config:
signing_region: '{{ signing_region }}'
signing_service_name: '{{ signing_service_name }}'
- name: lambda_config
value:
lambda_function_arn: '{{ lambda_function_arn }}'
- name: name
value: '{{ name }}'
- name: open_search_service_config
value:
aws_region: '{{ aws_region }}'
endpoint: '{{ endpoint }}'
- name: relational_database_config
value:
rds_http_endpoint_config:
database_name: '{{ database_name }}'
aws_region: '{{ aws_region }}'
db_cluster_identifier: '{{ db_cluster_identifier }}'
aws_secret_store_arn: '{{ aws_secret_store_arn }}'
schema: '{{ schema }}'
relational_database_source_type: '{{ relational_database_source_type }}'
- name: service_role_arn
value: '{{ service_role_arn }}'
- name: type
value: '{{ type }}'
- name: metrics_config
value: '{{ metrics_config }}'
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.appsync.data_sources
WHERE
Identifier = '{{ data_source_arn }}' AND
region = 'us-east-1';
Permissions
To operate on the data_sources resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
appsync:CreateDataSource,
appsync:GetDataSource,
iam:PassRole
appsync:GetDataSource
appsync:UpdateDataSource,
iam:PassRole
appsync:DeleteDataSource,
appsync:GetDataSource
appsync:ListDataSources