diff --git a/README.md b/README.md index cb4cfd45682..ae4d64968c3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ - [CDK for deploying single-node and multi-node OpenSearch cluster with OpenSearch Dashboards](#cdk-for-deploying-single-node-and-multi-node-opensearch-cluster-with-opensearch-dashboards) - [Getting Started](#getting-started) - [Deployment](#deployment) - - [Required context parameters](#required-context-parameters) + - [Available context parameters](#available-context-parameters) - [Sample command to set up multi-node cluster with security enabled on x64 AL2 machine](#sample-command-to-set-up-multi-node-cluster-with-security-enabled-on-x64-al2-machine) - [Interacting with OpenSearch cluster](#interacting-with-opensearch-cluster) - [Sample commands](#sample-commands) @@ -33,49 +33,51 @@ There are two stacks that get deployed: ## Deployment -### Required context parameters +### Available context parameters In order to deploy both the stacks the user needs to provide a set of required and optional parameters listed below: -| Name | Requirement | Type | Description | -|-------------------------------|:------------|:--------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| distVersion | Required | string | The OpenSearch distribution version (released/un-released) the user wants to deploy | -| securityDisabled | Required | boolean | Enable or disable security plugin | -| adminPassword | Optional | string | This value is required when security plugin is enabled and the cluster version | -| minDistribution | Required | boolean | Is it the minimal OpenSearch distribution with no security and plugins | -| distributionUrl | Required | string | OpenSearch tar distribution url | -| cpuArch | Required | string | CPU platform for EC2, could be either `x64` or `arm64` | -| singleNodeCluster | Required | boolean | Set `true` for single-node cluster else `false` for multi-node | -| serverAccessType | Required | string | Restrict server access based on ip address (ipv4/ipv6), prefix list and/or security group. See [Restricting Server Access](#restricting-server-access) for more details. | -| restrictServerAccessTo | Required | string | The value for `serverAccessType`, e.g., 10.10.10.10/32, pl-12345, sg-12345. See [Restricting Server Access](#restricting-server-access) for more details. | -| dashboardsUrl | Optional | string | OpenSearch Dashboards tar distribution url | -| vpcId | Optional | string | Re-use existing vpc, provide vpc id | -| securityGroupId | Optional | boolean | Re-use existing security group, provide security group id | -| cidr | Optional | string | User provided CIDR block for new Vpc. Defaults to `10.0.0.0/16` | -| managerNodeCount | Optional | integer | Number of cluster manager nodes. Defaults to 3 | -| dataNodeCount | Optional | integer | Number of data nodes. Defaults to 2 | -| clientNodeCount | Optional | integer | Number of dedicated client nodes. Defaults to 0 | -| ingestNodeCount | Optional | integer | Number of dedicated ingest nodes. Defaults to 0 | -| mlNodeCount | Optional | integer | Number of dedicated machine learning nodes. Defaults to 0 | -| dataInstanceType | Optional | string | EC2 instance type for data node. Defaults to r5.xlarge. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c dataInstanceType=m5.xlarge` | -| mlInstanceType | Optional | string | EC2 instance type for ml node. Defaults to r5.xlarge. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c mlInstanceType=m5.xlarge` | -| jvmSysProps | Optional | string | A comma-separated list of key=value pairs that will be added to `jvm.options` as JVM system properties. | -| additionalConfig | Optional | string | Additional opensearch.yml config parameters passed as JSON. Please be aware that this JSON merges with original opensearch.yml overwriting duplicate keys e.g., `--context additionalConfig='{"plugins.security.nodes_dn": ["CN=*.example.com, OU=SSL, O=Test, L=Test, C=DE", "CN=node.other.com, OU=SSL, O=Test, L=Test, C=DE"], "plugins.security.nodes_dn_dynamic_config_enabled": false}'` | -| additionalOsdConfig | Optional | string | Additional opensearch_dashboards.yml config parameters passed as JSON. Please be aware that this JSON merges with original opensearch-dashboards.yml overwriting duplicate keys. e.g., `additionalOsdConfig='{"data.search.usageTelemetry.enabled": "true"}'` | -| suffix | Optional | string | An optional string identifier to be concatenated with infra stack name. | -| networkStackSuffix (Optional) | string | An optional string identifier to be concatenated with network stack name. | | -| region | Optional | string | User provided aws region | -| account | Optional | string | User provided aws account | -| dataNodeStorage | Optional | string | User provided ebs block storage size. Defaults to 100Gb | -| mlNodeStorage | Optional | string | User provided ebs block storage size. Defaults to 100Gb | -| use50PercentHeap | Optional | boolean | Boolean flag to use 50% of physical memory as heap. Defaults to 1GB. e.g., `--context use50PercentHeap=true` | -| isInternal | Optional | boolean | Boolean flag to make network load balancer internal. Defaults to internet-facing e.g., `--context isInternal=true` | -| enableRemoteStore | Optional | boolean | Boolean flag to enable Remote Store feature e.g., `--context enableRemoteStore=true`. See [Enable Remote Store Feature](#enable-remote-store-feature) for more details. Defaults to false | -| storageVolumeType | Optional | string | EBS volume type for all the nodes (data, ml, cluster manager). Defaults to gp2. See `lib/opensearch-config/node-config.ts` for available options. E.g., `-c storageVolumeType=gp3`. For SSD based instance (i.e. i3 family), it is used for root volume configuration. | -| customRoleArn | Optional | string | User provided IAM role arn to be used as ec2 instance profile. `-c customRoleArn=arn:aws:iam:::role/` | -| customConfigFiles | Optional | string | You can provide an entire config file to be overwritten or added to OpenSearch and OpenSearch Dashboards. Pass string in the form of JSON with key as local path to the config file to read from and value as file on the server to overwrite/add. Note that the values in the JSON needs to have prefix of `opensearch` or `opensearch-dashboards`. Example: `-c customConfigFiles='{"opensearch-config/config.yml": "opensearch/config/opensearch-security/config.yml", "opensearch-config/role_mapping.yml":"opensearch/config/opensearch-security/roles_mapping.yml", "/roles.yml": "opensearch/config/opensearch-security/roles.yml"}'` | -| enableMonitoring | Optional | boolean | Boolean flag to enable monitoring and alarms for Infra Stack. See [InfraStackMonitoring class](./lib/monitoring/alarms.ts) for more details. Defaults to false e.g., `--context enableMonitoring=true` | -| certificateArn | Optional | string | Add ACM certificate to the listener. e.g., `--context certificateArn=arn:1234` | +| Name | Requirement | Type | Description | +|-------------------------------|:------------|:----------|:------------| +| distVersion | Required | string | The OpenSearch distribution version (released/un-released) the user wants to deploy | +| securityDisabled | Required | boolean | Enable or disable security plugin | +| adminPassword | Optionally required | string | This value is required when security plugin is enabled and the cluster version is greater or equal to `2.12.0`| +| minDistribution | Required | boolean | Is it the minimal OpenSearch distribution with no security and plugins | +| distributionUrl | Required | string | OpenSearch tar distribution url | +| cpuArch | Required | string | CPU platform for EC2, could be either `x64` or `arm64` | +| singleNodeCluster | Required | boolean | Set `true` for single-node cluster else `false` for multi-node | +| serverAccessType | Required | string | Restrict server access based on ip address (ipv4/ipv6), prefix list and/or security group. See [Restricting Server Access](#restricting-server-access) for more details. | +| restrictServerAccessTo | Required | string | The value for `serverAccessType`, e.g., 10.10.10.10/32, pl-12345, sg-12345. See [Restricting Server Access](#restricting-server-access) for more details. | +| dashboardsUrl | Optional | string | OpenSearch Dashboards tar distribution url | +| vpcId | Optional | string | Re-use existing vpc, provide vpc id | +| securityGroupId | Optional | boolean | Re-use existing security group, provide security group id | +| cidr | Optional | string | User provided CIDR block for new Vpc. Defaults to `10.0.0.0/16` | +| managerNodeCount | Optional | integer | Number of cluster manager nodes. Defaults to 3 | +| dataNodeCount | Optional | integer | Number of data nodes. Defaults to 2 | +| clientNodeCount | Optional | integer | Number of dedicated client nodes. Defaults to 0 | +| ingestNodeCount | Optional | integer | Number of dedicated ingest nodes. Defaults to 0 | +| mlNodeCount | Optional | integer | Number of dedicated machine learning nodes. Defaults to 0 | +| dataInstanceType | Optional | string | EC2 instance type for data node. Defaults to r5.xlarge. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c dataInstanceType=m5.xlarge` | +| mlInstanceType | Optional | string | EC2 instance type for ml node. Defaults to r5.xlarge. See options in `lib/opensearch-config/node-config.ts` for available options. E.g., `-c mlInstanceType=m5.xlarge` | +| jvmSysProps | Optional | string | A comma-separated list of key=value pairs that will be added to `jvm.options` as JVM system properties. | +| additionalConfig | Optional | string | Additional opensearch.yml config parameters passed as JSON. Please be aware that this JSON merges with original opensearch.yml overwriting duplicate keys e.g., `--context additionalConfig='{"plugins.security.nodes_dn": ["CN=*.example.com, OU=SSL, O=Test, L=Test, C=DE", "CN=node.other.com, OU=SSL, O=Test, L=Test, C=DE"], "plugins.security.nodes_dn_dynamic_config_enabled": false}'` | +| additionalOsdConfig | Optional | string | Additional opensearch_dashboards.yml config parameters passed as JSON. Please be aware that this JSON merges with original opensearch-dashboards.yml overwriting duplicate keys. e.g., `additionalOsdConfig='{"data.search.usageTelemetry.enabled": "true"}'` | +| suffix | Optional | string | An optional string identifier to be concatenated with infra stack name. | +| networkStackSuffix | Optional | string | An optional string identifier to be concatenated with network stack name. | | +| region | Optional | string | User provided aws region | +| account | Optional | string | User provided aws account| +| dataNodeStorage | Optional | string | User provided ebs block storage size. Defaults to 100Gb | +| mlNodeStorage | Optional | string | User provided ebs block storage size. Defaults to 100Gb | +| use50PercentHeap | Optional | boolean | Boolean flag to use 50% of physical memory as heap. Defaults to 1GB. e.g., `--context use50PercentHeap=true` | +| isInternal | Optional | boolean | Boolean flag to make network load balancer internal. Defaults to internet-facing e.g., `--context isInternal=true` | +| enableRemoteStore | Optional | boolean | Boolean flag to enable Remote Store feature e.g., `--context enableRemoteStore=true`. See [Enable Remote Store Feature](#enable-remote-store-feature) for more details. Defaults to false | +| storageVolumeType | Optional | string | EBS volume type for all the nodes (data, ml, cluster manager). Defaults to gp2. See `lib/opensearch-config/node-config.ts` for available options. E.g., `-c storageVolumeType=gp3`. For SSD based instance (i.e. i3 family), it is used for root volume configuration. | +| customRoleArn | Optional | string | User provided IAM role arn to be used as ec2 instance profile. `-c customRoleArn=arn:aws:iam:::role/`| +| customConfigFiles | Optional | string | You can provide an entire config file to be overwritten or added to OpenSearch and OpenSearch Dashboards. Pass string in the form of JSON with key as local path to the config file to read from and value as file on the server to overwrite/add. Note that the values in the JSON needs to have prefix of `opensearch` or `opensearch-dashboards`. Example: `-c customConfigFiles='{"opensearch-config/config.yml": "opensearch/config/opensearch-security/config.yml", "opensearch-config/role_mapping.yml":"opensearch/config/opensearch-security/roles_mapping.yml", "/roles.yml": "opensearch/config/opensearch-security/roles.yml"}'` | +| enableMonitoring | Optional | boolean | Boolean flag to enable monitoring and alarms for Infra Stack. See [InfraStackMonitoring class](./lib/monitoring/alarms.ts) for more details. Defaults to false e.g., `--context enableMonitoring=true` | +| certificateArn | Optional | string | Add ACM certificate to the listener. e.g., `--context certificateArn=arn:1234`| +| mapOpensearchPortTo | Optional | integer | Load balancer port number to map to OpenSearch. e.g., `--context mapOpensearchPortTo=8440` Defaults to 80 when security is disabled and 443 when security is enabled | +| mapOpensearchDashboardsPortTo | Optional | integer | Load balancer port number to map to OpenSearch-Dashboards. e.g., `--context mapOpensearchDashboardsPortTo=443` Always defaults to 8443 | * Before starting this step, ensure that your AWS CLI is correctly configured with access credentials. * Also ensure that you're running these commands in the current directory @@ -173,6 +175,7 @@ The ports to access the cluster are dependent on the `security` parameter value * If `security` is `enable` (HTTPS), * OpenSearch 9200 is mapped to port 443 on the LB * OpenSearch-Dasboards 5601 is always mapped to port 8443 on the LB (HTTP) +Change the port mapping using context variables `mapOpensearchPortTo` and `mapOpensearchDashboardsPortTo` . See [available context parameters)](#available-context-parameters) for more details ## Teardown diff --git a/package-lock.json b/package-lock.json index 8795e37a8c1..3f951777467 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@opensearch-project/opensearch-cluster-cdk", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@opensearch-project/opensearch-cluster-cdk", - "version": "1.1.0", + "version": "1.2.0", "dependencies": { "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", diff --git a/package.json b/package.json index 91d87757c8f..de96bcda955 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@opensearch-project/opensearch-cluster-cdk", - "version": "1.1.0", + "version": "1.2.0", "bin": { "cdk_v2": "bin/app.js" },