Skip to content
v2.277.0

CfnDataSourceProps Struct ​

Properties for defining a CfnDataSource.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
const cfnDataSourceProps: appsync.CfnDataSourceProps = {
  apiId: 'apiId',
  name: 'name',
  type: 'type',

  // the properties below are optional
  description: 'description',
  dynamoDbConfig: {
    awsRegion: 'awsRegion',
    tableName: 'tableName',

    // the properties below are optional
    deltaSyncConfig: {
      baseTableTtl: 'baseTableTtl',
      deltaSyncTableName: 'deltaSyncTableName',
      deltaSyncTableTtl: 'deltaSyncTableTtl',
    },
    useCallerCredentials: false,
    versioned: false,
  },
  elasticsearchConfig: {
    awsRegion: 'awsRegion',
    endpoint: 'endpoint',
  },
  eventBridgeConfig: {
    eventBusArn: 'eventBusArn',
  },
  httpConfig: {
    endpoint: 'endpoint',

    // the properties below are optional
    authorizationConfig: {
      authorizationType: 'authorizationType',

      // the properties below are optional
      awsIamConfig: {
        signingRegion: 'signingRegion',
        signingServiceName: 'signingServiceName',
      },
    },
  },
  lambdaConfig: {
    lambdaFunctionArn: 'lambdaFunctionArn',
  },
  metricsConfig: 'metricsConfig',
  openSearchServiceConfig: {
    awsRegion: 'awsRegion',
    endpoint: 'endpoint',
  },
  relationalDatabaseConfig: {
    relationalDatabaseSourceType: 'relationalDatabaseSourceType',

    // the properties below are optional
    rdsHttpEndpointConfig: {
      awsRegion: 'awsRegion',
      awsSecretStoreArn: 'awsSecretStoreArn',
      dbClusterIdentifier: 'dbClusterIdentifier',

      // the properties below are optional
      databaseName: 'databaseName',
      schema: 'schema',
    },
  },
  serviceRoleArn: 'serviceRoleArn',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync

cfn_data_source_props = appsync.CfnDataSourceProps(
    api_id="apiId",
    name="name",
    type="type",

    # the properties below are optional
    description="description",
    dynamo_db_config=appsync.CfnDataSource.DynamoDBConfigProperty(
        aws_region="awsRegion",
        table_name="tableName",

        # the properties below are optional
        delta_sync_config=appsync.CfnDataSource.DeltaSyncConfigProperty(
            base_table_ttl="baseTableTtl",
            delta_sync_table_name="deltaSyncTableName",
            delta_sync_table_ttl="deltaSyncTableTtl"
        ),
        use_caller_credentials=False,
        versioned=False
    ),
    elasticsearch_config=appsync.CfnDataSource.ElasticsearchConfigProperty(
        aws_region="awsRegion",
        endpoint="endpoint"
    ),
    event_bridge_config=appsync.CfnDataSource.EventBridgeConfigProperty(
        event_bus_arn="eventBusArn"
    ),
    http_config=appsync.CfnDataSource.HttpConfigProperty(
        endpoint="endpoint",

        # the properties below are optional
        authorization_config=appsync.CfnDataSource.AuthorizationConfigProperty(
            authorization_type="authorizationType",

            # the properties below are optional
            aws_iam_config=appsync.CfnDataSource.AwsIamConfigProperty(
                signing_region="signingRegion",
                signing_service_name="signingServiceName"
            )
        )
    ),
    lambda_config=appsync.CfnDataSource.LambdaConfigProperty(
        lambda_function_arn="lambdaFunctionArn"
    ),
    metrics_config="metricsConfig",
    open_search_service_config=appsync.CfnDataSource.OpenSearchServiceConfigProperty(
        aws_region="awsRegion",
        endpoint="endpoint"
    ),
    relational_database_config=appsync.CfnDataSource.RelationalDatabaseConfigProperty(
        relational_database_source_type="relationalDatabaseSourceType",

        # the properties below are optional
        rds_http_endpoint_config=appsync.CfnDataSource.RdsHttpEndpointConfigProperty(
            aws_region="awsRegion",
            aws_secret_store_arn="awsSecretStoreArn",
            db_cluster_identifier="dbClusterIdentifier",

            # the properties below are optional
            database_name="databaseName",
            schema="schema"
        )
    ),
    service_role_arn="serviceRoleArn"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;

CfnDataSourceProps cfnDataSourceProps = CfnDataSourceProps.builder()
        .apiId("apiId")
        .name("name")
        .type("type")

        // the properties below are optional
        .description("description")
        .dynamoDbConfig(DynamoDBConfigProperty.builder()
                .awsRegion("awsRegion")
                .tableName("tableName")

                // the properties below are optional
                .deltaSyncConfig(DeltaSyncConfigProperty.builder()
                        .baseTableTtl("baseTableTtl")
                        .deltaSyncTableName("deltaSyncTableName")
                        .deltaSyncTableTtl("deltaSyncTableTtl")
                        .build())
                .useCallerCredentials(false)
                .versioned(false)
                .build())
        .elasticsearchConfig(ElasticsearchConfigProperty.builder()
                .awsRegion("awsRegion")
                .endpoint("endpoint")
                .build())
        .eventBridgeConfig(EventBridgeConfigProperty.builder()
                .eventBusArn("eventBusArn")
                .build())
        .httpConfig(HttpConfigProperty.builder()
                .endpoint("endpoint")

                // the properties below are optional
                .authorizationConfig(AuthorizationConfigProperty.builder()
                        .authorizationType("authorizationType")

                        // the properties below are optional
                        .awsIamConfig(AwsIamConfigProperty.builder()
                                .signingRegion("signingRegion")
                                .signingServiceName("signingServiceName")
                                .build())
                        .build())
                .build())
        .lambdaConfig(LambdaConfigProperty.builder()
                .lambdaFunctionArn("lambdaFunctionArn")
                .build())
        .metricsConfig("metricsConfig")
        .openSearchServiceConfig(OpenSearchServiceConfigProperty.builder()
                .awsRegion("awsRegion")
                .endpoint("endpoint")
                .build())
        .relationalDatabaseConfig(RelationalDatabaseConfigProperty.builder()
                .relationalDatabaseSourceType("relationalDatabaseSourceType")

                // the properties below are optional
                .rdsHttpEndpointConfig(RdsHttpEndpointConfigProperty.builder()
                        .awsRegion("awsRegion")
                        .awsSecretStoreArn("awsSecretStoreArn")
                        .dbClusterIdentifier("dbClusterIdentifier")

                        // the properties below are optional
                        .databaseName("databaseName")
                        .schema("schema")
                        .build())
                .build())
        .serviceRoleArn("serviceRoleArn")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;

var cfnDataSourceProps = new CfnDataSourceProps {
    ApiId = "apiId",
    Name = "name",
    Type = "type",

    // the properties below are optional
    Description = "description",
    DynamoDbConfig = new DynamoDBConfigProperty {
        AwsRegion = "awsRegion",
        TableName = "tableName",

        // the properties below are optional
        DeltaSyncConfig = new DeltaSyncConfigProperty {
            BaseTableTtl = "baseTableTtl",
            DeltaSyncTableName = "deltaSyncTableName",
            DeltaSyncTableTtl = "deltaSyncTableTtl"
        },
        UseCallerCredentials = false,
        Versioned = false
    },
    ElasticsearchConfig = new ElasticsearchConfigProperty {
        AwsRegion = "awsRegion",
        Endpoint = "endpoint"
    },
    EventBridgeConfig = new EventBridgeConfigProperty {
        EventBusArn = "eventBusArn"
    },
    HttpConfig = new HttpConfigProperty {
        Endpoint = "endpoint",

        // the properties below are optional
        AuthorizationConfig = new AuthorizationConfigProperty {
            AuthorizationType = "authorizationType",

            // the properties below are optional
            AwsIamConfig = new AwsIamConfigProperty {
                SigningRegion = "signingRegion",
                SigningServiceName = "signingServiceName"
            }
        }
    },
    LambdaConfig = new LambdaConfigProperty {
        LambdaFunctionArn = "lambdaFunctionArn"
    },
    MetricsConfig = "metricsConfig",
    OpenSearchServiceConfig = new OpenSearchServiceConfigProperty {
        AwsRegion = "awsRegion",
        Endpoint = "endpoint"
    },
    RelationalDatabaseConfig = new RelationalDatabaseConfigProperty {
        RelationalDatabaseSourceType = "relationalDatabaseSourceType",

        // the properties below are optional
        RdsHttpEndpointConfig = new RdsHttpEndpointConfigProperty {
            AwsRegion = "awsRegion",
            AwsSecretStoreArn = "awsSecretStoreArn",
            DbClusterIdentifier = "dbClusterIdentifier",

            // the properties below are optional
            DatabaseName = "databaseName",
            Schema = "schema"
        }
    },
    ServiceRoleArn = "serviceRoleArn"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnDataSourceProps := &CfnDataSourceProps{
	ApiId: jsii.String("apiId"),
	Name: jsii.String("name"),
	Type: jsii.String("type"),

	// the properties below are optional
	Description: jsii.String("description"),
	DynamoDbConfig: &DynamoDBConfigProperty{
		AwsRegion: jsii.String("awsRegion"),
		TableName: jsii.String("tableName"),

		// the properties below are optional
		DeltaSyncConfig: &DeltaSyncConfigProperty{
			BaseTableTtl: jsii.String("baseTableTtl"),
			DeltaSyncTableName: jsii.String("deltaSyncTableName"),
			DeltaSyncTableTtl: jsii.String("deltaSyncTableTtl"),
		},
		UseCallerCredentials: jsii.Boolean(false),
		Versioned: jsii.Boolean(false),
	},
	ElasticsearchConfig: &ElasticsearchConfigProperty{
		AwsRegion: jsii.String("awsRegion"),
		Endpoint: jsii.String("endpoint"),
	},
	EventBridgeConfig: &EventBridgeConfigProperty{
		EventBusArn: jsii.String("eventBusArn"),
	},
	HttpConfig: &HttpConfigProperty{
		Endpoint: jsii.String("endpoint"),

		// the properties below are optional
		AuthorizationConfig: &AuthorizationConfigProperty{
			AuthorizationType: jsii.String("authorizationType"),

			// the properties below are optional
			AwsIamConfig: &AwsIamConfigProperty{
				SigningRegion: jsii.String("signingRegion"),
				SigningServiceName: jsii.String("signingServiceName"),
			},
		},
	},
	LambdaConfig: &LambdaConfigProperty{
		LambdaFunctionArn: jsii.String("lambdaFunctionArn"),
	},
	MetricsConfig: jsii.String("metricsConfig"),
	OpenSearchServiceConfig: &OpenSearchServiceConfigProperty{
		AwsRegion: jsii.String("awsRegion"),
		Endpoint: jsii.String("endpoint"),
	},
	RelationalDatabaseConfig: &RelationalDatabaseConfigProperty{
		RelationalDatabaseSourceType: jsii.String("relationalDatabaseSourceType"),

		// the properties below are optional
		RdsHttpEndpointConfig: &RdsHttpEndpointConfigProperty{
			AwsRegion: jsii.String("awsRegion"),
			AwsSecretStoreArn: jsii.String("awsSecretStoreArn"),
			DbClusterIdentifier: jsii.String("dbClusterIdentifier"),

			// the properties below are optional
			DatabaseName: jsii.String("databaseName"),
			Schema: jsii.String("schema"),
		},
	},
	ServiceRoleArn: jsii.String("serviceRoleArn"),
}

Properties ​

apiIdstringapi_idstrapiIdStringApiIdstringApiId*string required #
Unique AWS AppSync GraphQL API identifier where this data source will be created.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
The description of the data source.
dynamoDbConfigoptionalIResolvable | CfnDataSource.DynamoDBConfigPropertydynamo_db_configoptionaltyping.Union[IResolvable, DynamoDBConfigProperty]dynamoDbConfigoptionalIResolvableDynamoDbConfigoptionalIResolvableDynamoDbConfigoptionalinterface{} #
AWS Region and TableName for an Amazon DynamoDB table in your account.
elasticsearchConfigoptionalIResolvable | CfnDataSource.ElasticsearchConfigPropertyelasticsearch_configoptionaltyping.Union[IResolvable, ElasticsearchConfigProperty]elasticsearchConfigoptionalIResolvableElasticsearchConfigoptionalIResolvableElasticsearchConfigoptionalinterface{} deprecated #
this property has been deprecated
eventBridgeConfigoptionalIResolvable | CfnDataSource.EventBridgeConfigPropertyevent_bridge_configoptionaltyping.Union[IResolvable, EventBridgeConfigProperty]eventBridgeConfigoptionalIResolvableEventBridgeConfigoptionalIResolvableEventBridgeConfigoptionalinterface{} #
An EventBridge configuration that contains a valid ARN of an event bus.
httpConfigoptionalIResolvable | CfnDataSource.HttpConfigPropertyhttp_configoptionaltyping.Union[IResolvable, HttpConfigProperty]httpConfigoptionalIResolvableHttpConfigoptionalIResolvableHttpConfigoptionalinterface{} #
Endpoints for an HTTP data source.
lambdaConfigoptionalIResolvable | CfnDataSource.LambdaConfigPropertylambda_configoptionaltyping.Union[IResolvable, LambdaConfigProperty]lambdaConfigoptionalIResolvableLambdaConfigoptionalIResolvableLambdaConfigoptionalinterface{} #
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.

metricsConfigoptionalstringmetrics_configoptionalstrmetricsConfigoptionalStringMetricsConfigoptionalstringMetricsConfigoptional*string #
Enables or disables enhanced data source metrics for specified data sources.
notes

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 .

namestringnamestrnameStringNamestringName*string required #
Friendly name for you to identify your AppSync data source after creation.
openSearchServiceConfigoptionalIResolvable | CfnDataSource.OpenSearchServiceConfigPropertyopen_search_service_configoptionaltyping.Union[IResolvable, OpenSearchServiceConfigProperty]openSearchServiceConfigoptionalIResolvableOpenSearchServiceConfigoptionalIResolvableOpenSearchServiceConfigoptionalinterface{} #
AWS Region and Endpoints for an Amazon OpenSearch Service domain in your account.
relationalDatabaseConfigoptionalIResolvable | CfnDataSource.RelationalDatabaseConfigPropertyrelational_database_configoptionaltyping.Union[IResolvable, RelationalDatabaseConfigProperty]relationalDatabaseConfigoptionalIResolvableRelationalDatabaseConfigoptionalIResolvableRelationalDatabaseConfigoptionalinterface{} #
Relational Database configuration of the relational database data source.
serviceRoleArnoptionalstring | IRoleRefservice_role_arnoptionaltyping.Union[str, IRoleRef]serviceRoleArnoptionalStringServiceRoleArnoptionalstringServiceRoleArnoptionalinterface{} #
The AWS Identity and Access Management service role ARN for the data source.
notes

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 .

typestringtypestrtypeStringTypestringType*string required #
The type of the data source.
notes
  • 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.