AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::AppSync::DataSource

CfnDataSource

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.

Import

import { CfnDataSource } from 'aws-cdk-lib/aws-appsync';

Or use the module namespace:

import * as appsync from 'aws-cdk-lib/aws-appsync';
// appsync.CfnDataSource

Properties

Configuration passed to the constructor as CfnDataSourceProps.

apiIdRequired
string

Unique AWS AppSync GraphQL API identifier where this data source will be created.

nameRequired
string

Friendly name for you to identify your AppSync data source after creation.

typeRequired
string

The type of the data source. - *AWS_LAMBDA* : The data source is an AWS Lambda function. - *AMAZON_DYNAMODB* : The data source is an Amazon DynamoDB table. - *AMAZON_ELASTICSEARCH* : The data source is an Amazon OpenSearch Service domain. - *AMAZON_EVENTBRIDGE* : The data source is an Amazon EventBridge event bus. - *AMAZON_OPENSEARCH_SERVICE* : The data source is an Amazon OpenSearch Service domain. - *AMAZON_BEDROCK_RUNTIME* : The data source is the Amazon Bedrock runtime. - *NONE* : There is no data source. This type is used when you wish to invoke a GraphQL operation without connecting to a data source, such as performing data transformation with resolvers or triggering a subscription to be invoked from a mutation. - *HTTP* : The data source is an HTTP endpoint. - *RELATIONAL_DATABASE* : The data source is a relational database.

descriptionOptional
string

The description of the data source.

dynamoDbConfigOptional
IResolvable | DynamoDBConfigProperty

AWS Region and TableName for an Amazon DynamoDB table in your account.

elasticsearchConfigOptionalDeprecated
IResolvable | ElasticsearchConfigProperty

Deprecated: this property has been deprecated

eventBridgeConfigOptional
IResolvable | EventBridgeConfigProperty

An EventBridge configuration that contains a valid ARN of an event bus.

httpConfigOptional
IResolvable | HttpConfigProperty

Endpoints for an HTTP data source.

lambdaConfigOptional
IResolvable | LambdaConfigProperty

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.

metricsConfigOptional
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` .

openSearchServiceConfigOptional
IResolvable | OpenSearchServiceConfigProperty

AWS Region and Endpoints for an Amazon OpenSearch Service domain in your account.

relationalDatabaseConfigOptional
IResolvable | RelationalDatabaseConfigProperty

Relational Database configuration of the relational database data source.

serviceRoleArnOptional
string | IRoleRef

The AWS Identity and Access Management service role ARN for the data source. The system assumes this role when accessing the data source. Required if `Type` is specified as `AWS_LAMBDA` , `AMAZON_DYNAMODB` , `AMAZON_ELASTICSEARCH` , `AMAZON_EVENTBRIDGE` , `AMAZON_OPENSEARCH_SERVICE` , `RELATIONAL_DATABASE` , or `AMAZON_BEDROCK_RUNTIME` .

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Get the AWS AppSync Cheat Sheet

Everything you need to know about AWS AppSync on one page. HD quality, print-friendly.

Download Free Infographic