Skip to content

CDK create Opensearch domain for free tier instance

0

I would like to set up an OS domain for t3.small.search instance which qualifies for the free tier. However, not sure how to specify the required configuration in the CDK, for the below 2 points:

  • domain is provisioned without standby
  • instance count for the domain is less than 10

I referenced the above points from the AWS documentation: https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html

Here is what I have so far. Please advise on the full cdk declaration that I should use, including the 2 requirements listed above. Thank you.

const osDomain = new opensearch.Domain(this, 'os_domain', {
      version: opensearch.EngineVersion.OPENSEARCH_2_11,
    })
1 Answer
1

Hello.

You can create an Opensearch domain with "t3.small.search" as follows.
The number of data nodes and multi-AZ standby can be configured with a parameter called "capacity".
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_opensearchservice.Domain.html

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as opensearch from "aws-cdk-lib/aws-opensearchservice";

export class CdkAppStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const domain = new opensearch.Domain(this, 'Domain', {
      version: opensearch.EngineVersion.OPENSEARCH_2_11,
      capacity: {
        dataNodeInstanceType: "t3.small.search",
        dataNodes: 1,
        multiAzWithStandbyEnabled: false
      }
    });
  }
}
EXPERT
answered a year ago
EXPERT
reviewed a year ago
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.