Skip to content
v2.274.0

AppSyncOpenSearchDataSource ​

An Appsync datasource backed by OpenSearch.

Example ​

ts
import * as opensearch from 'aws-cdk-lib/aws-opensearchservice';

const domain = new opensearch.Domain(this, 'Domain', {
  version: opensearch.EngineVersion.OPENSEARCH_2_17,
  encryptionAtRest: {
    enabled: true,
  },
  nodeToNodeEncryption: true,
  enforceHttps: true,
  capacity: {
    multiAzWithStandbyEnabled: false,
  },
  ebs: {
    enabled: true,
    volumeSize: 10,
  },
});
const api = new appsync.EventApi(this, 'EventApiOpenSearch', {
  apiName: 'OpenSearchEventApi',
});

const dataSource = api.addOpenSearchDataSource('opensearchds', domain);
python
import aws_cdk.aws_opensearchservice as opensearch


domain = opensearch.Domain(self, "Domain",
    version=opensearch.EngineVersion.OPENSEARCH_2_17,
    encryption_at_rest=opensearch.EncryptionAtRestOptions(
        enabled=True
    ),
    node_to_node_encryption=True,
    enforce_https=True,
    capacity=opensearch.CapacityConfig(
        multi_az_with_standby_enabled=False
    ),
    ebs=opensearch.EbsOptions(
        enabled=True,
        volume_size=10
    )
)
api = appsync.EventApi(self, "EventApiOpenSearch",
    api_name="OpenSearchEventApi"
)

data_source = api.add_open_search_data_source("opensearchds", domain)
java
import software.amazon.awscdk.services.opensearchservice.*;


Domain domain = Domain.Builder.create(this, "Domain")
        .version(EngineVersion.OPENSEARCH_2_17)
        .encryptionAtRest(EncryptionAtRestOptions.builder()
                .enabled(true)
                .build())
        .nodeToNodeEncryption(true)
        .enforceHttps(true)
        .capacity(CapacityConfig.builder()
                .multiAzWithStandbyEnabled(false)
                .build())
        .ebs(EbsOptions.builder()
                .enabled(true)
                .volumeSize(10)
                .build())
        .build();
EventApi api = EventApi.Builder.create(this, "EventApiOpenSearch")
        .apiName("OpenSearchEventApi")
        .build();

AppSyncOpenSearchDataSource dataSource = api.addOpenSearchDataSource("opensearchds", domain);
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.OpenSearchService;


var domain = new Domain(this, "Domain", new DomainProps {
    Version = EngineVersion.OPENSEARCH_2_17,
    EncryptionAtRest = new EncryptionAtRestOptions {
        Enabled = true
    },
    NodeToNodeEncryption = true,
    EnforceHttps = true,
    Capacity = new CapacityConfig {
        MultiAzWithStandbyEnabled = false
    },
    Ebs = new EbsOptions {
        Enabled = true,
        VolumeSize = 10
    }
});
var api = new EventApi(this, "EventApiOpenSearch", new EventApiProps {
    ApiName = "OpenSearchEventApi"
});

var dataSource = api.AddOpenSearchDataSource("opensearchds", domain);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"


domain := opensearch.NewDomain(this, jsii.String("Domain"), &DomainProps{
	Version: opensearch.EngineVersion_OPENSEARCH_2_17(),
	EncryptionAtRest: &EncryptionAtRestOptions{
		Enabled: jsii.Boolean(true),
	},
	NodeToNodeEncryption: jsii.Boolean(true),
	EnforceHttps: jsii.Boolean(true),
	Capacity: &CapacityConfig{
		MultiAzWithStandbyEnabled: jsii.Boolean(false),
	},
	Ebs: &EbsOptions{
		Enabled: jsii.Boolean(true),
		VolumeSize: jsii.Number(10),
	},
})
api := appsync.NewEventApi(this, jsii.String("EventApiOpenSearch"), &EventApiProps{
	ApiName: jsii.String("OpenSearchEventApi"),
})

dataSource := api.AddOpenSearchDataSource(jsii.String("opensearchds"), domain)

Initializer ​

ts
new AppSyncOpenSearchDataSource(scope: Construct, id: string, props: AppSyncOpenSearchDataSourceProps)
python
AppSyncOpenSearchDataSource(scope: Construct, id: str, props: AppSyncOpenSearchDataSourceProps)
java
new AppSyncOpenSearchDataSource(Construct scope, String id, AppSyncOpenSearchDataSourceProps props)
csharp
new AppSyncOpenSearchDataSource(Construct scope, string id, AppSyncOpenSearchDataSourceProps props)
go
NewAppSyncOpenSearchDataSource(Scope Construct, Id *string, Props AppSyncOpenSearchDataSourceProps)

Construct Props ​

The API to attach this data source to.
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= None#
The description of the data source.
domainIDomaindomainIDomaindomainIDomainDomainIDomainDomainIDomainrequired#
The OpenSearch domain containing the endpoint for the data source.
namestringnamestrnameStringNamestringName*string= id of data source#
The name of the data source.

The only allowed pattern is: {[_A-Za-z][_0-9A-Za-z]*}. Any invalid characters will be automatically removed.

serviceRoleIRoleservice_roleIRoleserviceRoleIRoleServiceRoleIRoleServiceRoleIRole= Create a new role#
The IAM service role to be assumed by AppSync to interact with the data source.

Properties ​

grantPrincipalIPrincipalgrant_principalIPrincipalgrantPrincipalIPrincipalGrantPrincipalIPrincipalGrantPrincipalIPrincipalrequired#
The principal of the data source to be IGrantable.
namestringnamestrnameStringNamestringName*stringrequired#
The name of the data source.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
resourceCfnDataSourceresourceCfnDataSourceresourceCfnDataSourceResourceCfnDataSourceResourceCfnDataSourcerequired#
The underlying CFN data source resource.

Methods ​

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining