Skip to content

Domain

Source: src/AWS/OpenSearch/Domain.ts

An Amazon OpenSearch Service domain — a managed OpenSearch/Elasticsearch cluster with a search/HTTP endpoint.

Domains take roughly 15-25 minutes to provision (and about as long for blue/green configuration changes) and are billed per instance-hour while they exist. Destroy domains you are not using.

Minimal Domain

// A single t3.small.search node with 10 GiB of gp3 EBS storage.
const domain = yield* Domain("Search", {});

Encrypted Domain with Access Policy

const domain = yield* Domain("Search", {
engineVersion: "OpenSearch_2.19",
clusterConfig: { instanceType: "t3.small.search", instanceCount: 1 },
ebsOptions: { volumeType: "gp3", volumeSize: 10 },
encryptionAtRest: { enabled: true },
nodeToNodeEncryption: true,
domainEndpointOptions: {
enforceHTTPS: true,
tlsSecurityPolicy: "Policy-Min-TLS-1-2-2019-07",
},
accessPolicies: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { AWS: `arn:aws:iam::${accountId}:root` },
Action: ["es:*"],
Resource: `arn:aws:es:${region}:${accountId}:domain/*`,
},
],
},
});
const domain = yield* Domain("Search", {
clusterConfig: {
instanceType: "r7g.large.search",
instanceCount: 2,
zoneAwarenessEnabled: true,
availabilityZoneCount: 2,
},
});