AWS AppSync Datasource
This page shows how to write Terraform and CloudFormation for AWS AppSync Datasource and write them securely.
aws_appsync_datasource (Terraform)
The Datasource in AWS AppSync can be configured in Terraform with the resource name aws_appsync_datasource
. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_appsync_datasource" "poc_ds_person" {
api_id = aws_appsync_graphql_api.poc_appsync_api.id
name = "ds_person"
service_role_arn = aws_iam_role.appsync_api.arn
type = "AMAZON_DYNAMODB"
Parameters
-
api_id
required - string -
arn
optional computed - string -
description
optional - string -
id
optional computed - string -
name
required - string -
service_role_arn
optional - string -
type
required - string -
dynamodb_config
list block-
region
optional computed - string -
table_name
required - string -
use_caller_credentials
optional - bool
-
-
elasticsearch_config
list block -
http_config
list block-
endpoint
required - string
-
-
lambda_config
list block-
function_arn
required - string
-
Explanation in Terraform Registry
Provides an AppSync DataSource.
AWS::AppSync::DataSource (CloudFormation)
The DataSource in AppSync can be configured in CloudFormation with the resource name AWS::AppSync::DataSource
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
-
Type
required - String -
OpenSearchServiceConfig
optional - OpenSearchServiceConfig -
Description
optional - String -
ServiceRoleArn
optional - String -
HttpConfig
optional - HttpConfig -
RelationalDatabaseConfig
optional - RelationalDatabaseConfig -
LambdaConfig
optional - LambdaConfig -
ApiId
required - String -
Name
required - String -
DynamoDBConfig
optional - DynamoDBConfig -
ElasticsearchConfig
optional - ElasticsearchConfig
Explanation in CloudFormation Registry
The
AWS::AppSync::DataSource
resource creates data sources for resolvers in AWS AppSync to connect to, such as Amazon DynamoDB, AWS Lambda, and Amazon OpenSearch Service. Resolvers use these data sources to fetch data when clients make GraphQL calls.
Frequently asked questions
What is AWS AppSync Datasource?
AWS AppSync Datasource is a resource for AppSync of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS AppSync Datasource?
For Terraform, the jjoc007/poc-appsync-golang-mongo source code example is useful. See the Terraform Example section for further details.