@Stability(value=Experimental)
See: Description
| Interface | Description |
|---|---|
| AdvancedSecurityOptions |
(experimental) Specifies options for fine-grained access control.
|
| CapacityConfig |
(experimental) Configures the capacity of the cluster such as the instance type and the number of instances.
|
| CfnDomain.AdvancedSecurityOptionsInputProperty | |
| CfnDomain.CognitoOptionsProperty | |
| CfnDomain.DomainEndpointOptionsProperty | |
| CfnDomain.EBSOptionsProperty | |
| CfnDomain.ElasticsearchClusterConfigProperty | |
| CfnDomain.EncryptionAtRestOptionsProperty | |
| CfnDomain.LogPublishingOptionProperty | |
| CfnDomain.MasterUserOptionsProperty | |
| CfnDomain.NodeToNodeEncryptionOptionsProperty | |
| CfnDomain.SnapshotOptionsProperty | |
| CfnDomain.VPCOptionsProperty | |
| CfnDomain.ZoneAwarenessConfigProperty | |
| CfnDomainProps |
Properties for defining a `AWS::Elasticsearch::Domain`.
|
| CognitoOptions |
(experimental) Configures Amazon ES to use Amazon Cognito authentication for Kibana.
|
| CustomEndpointOptions |
(experimental) Configures a custom domain endpoint for the ES domain.
|
| DomainAttributes |
(experimental) Reference to an Elasticsearch domain.
|
| DomainProps |
(experimental) Properties for an AWS Elasticsearch Domain.
|
| EbsOptions |
(experimental) The configurations of Amazon Elastic Block Store (Amazon EBS) volumes that are attached to data nodes in the Amazon ES domain.
|
| EncryptionAtRestOptions |
(experimental) Whether the domain should encrypt data at rest, and if so, the AWS Key Management Service (KMS) key to use.
|
| IDomain |
(experimental) An interface that represents an Elasticsearch domain - either created with the CDK, or an existing one.
|
| IDomain.Jsii$Default |
Internal default implementation for
IDomain. |
| LoggingOptions |
(experimental) Configures log settings for the domain.
|
| VpcOptions |
(experimental) The virtual private cloud (VPC) configuration for the Amazon ES domain.
|
| ZoneAwarenessConfig |
(experimental) Specifies zone awareness configuration options.
|
| Enum | Description |
|---|---|
| TLSSecurityPolicy |
(experimental) The minimum TLS version required for traffic to the domain.
|
---
Features | Stability
-----------------------------------|----------------------------------------------------------------
CFN Resources |
Higher level constructs for Domain |
CFN Resources: All classes with the
Cfnprefix in this module (CFN Resources) are always stable and safe to use.
Experimental: Higher level constructs in this module that are marked as experimental are under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.
Create a development cluster by simply specifying the version:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import software.amazon.awscdk.services.elasticsearch.*;
Domain devDomain = new Domain(this, "Domain", new DomainProps()
.version(es.ElasticsearchVersion.getV7_1()));
To perform version upgrades without replacing the entire domain, specify the enableVersionUpgrade property.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import software.amazon.awscdk.services.elasticsearch.*;
Domain devDomain = new Domain(this, "Domain", new DomainProps()
.version(es.ElasticsearchVersion.getV7_9())
.enableVersionUpgrade(true));
Create a production grade cluster by also specifying things like capacity and az distribution
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object prodDomain = Domain.Builder.create(this, "Domain")
.version(es.ElasticsearchVersion.getV7_1())
.capacity(Map.of(
"masterNodes", 5,
"dataNodes", 20))
.ebs(Map.of(
"volumeSize", 20))
.zoneAwareness(Map.of(
"availabilityZoneCount", 3))
.logging(Map.of(
"slowSearchLogEnabled", true,
"appLogEnabled", true,
"slowIndexLogEnabled", true))
.build();
This creates an Elasticsearch cluster and automatically sets up log groups for logging the domain logs and slow search logs.
To import an existing domain into your CDK application, use the Domain.fromDomainEndpoint factory method.
This method accepts a domain endpoint of an already existing domain:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 String domainEndpoint = "https://my-domain-jcjotrt6f7otem4sqcwbch3c4u.us-east-1.es.amazonaws.com"; Object domain = Domain.fromDomainEndpoint(this, "ImportedDomain", domainEndpoint);
Helper methods also exist for managing access to the domain.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object lambda = Function.Builder.create(this, "Lambda").build();
// Grant write access to the app-search index
domain.grantIndexWrite("app-search", lambda);
// Grant read access to the 'app-search/_search' path
domain.grantPathRead("app-search/_search", lambda);
The domain can also be created with encryption enabled:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object domain = Domain.Builder.create(this, "Domain")
.version(es.ElasticsearchVersion.getV7_4())
.ebs(Map.of(
"volumeSize", 100,
"volumeType", EbsDeviceVolumeType.getGENERAL_PURPOSE_SSD()))
.nodeToNodeEncryption(true)
.encryptionAtRest(Map.of(
"enabled", true))
.build();
This sets up the domain with node to node encryption and encryption at rest. You can also choose to supply your own KMS key to use for encryption at rest.
Helper methods exist to access common domain metrics for example:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object freeStorageSpace = domain.metricFreeStorageSpace();
Object masterSysMemoryUtilization = domain.metric("MasterSysMemoryUtilization");
This module is part of the AWS Cloud Development Kit project.
The domain can also be created with a master user configured. The password can be supplied or dynamically created if not supplied.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object domain = Domain.Builder.create(this, "Domain")
.version(es.ElasticsearchVersion.getV7_1())
.enforceHttps(true)
.nodeToNodeEncryption(true)
.encryptionAtRest(Map.of(
"enabled", true))
.fineGrainedAccessControl(Map.of(
"masterUserName", "master-user"))
.build();
Object masterUserPassword = domain.getMasterUserPassword();
For convenience, the domain can be configured to allow unsigned HTTP requests that use basic auth. Unless the domain is configured to be part of a VPC this means anyone can access the domain using the configured master username and password.
To enable unsigned basic auth access the domain is configured with an access policy that allows anyonmous requests, HTTPS required, node to node encryption, encryption at rest and fine grained access control.
If the above settings are not set they will be configured as part of enabling unsigned basic auth. If they are set with conflicting values, an error will be thrown.
If no master user is configured a default master user is created with the
username admin.
If no password is configured a default master user password is created and
stored in the AWS Secrets Manager as secret. The secret has the prefix
<domain id>MasterUser.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object domain = Domain.Builder.create(this, "Domain")
.version(es.ElasticsearchVersion.getV7_1())
.useUnsignedBasicAuth(true)
.build();
Object masterUserPassword = domain.getMasterUserPassword();
Audit logs can be enabled for a domain, but only when fine grained access control is enabled.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object domain = Domain.Builder.create(this, "Domain")
.version(es.ElasticsearchVersion.getV7_1())
.enforceHttps(true)
.nodeToNodeEncryption(true)
.encryptionAtRest(Map.of(
"enabled", true))
.fineGrainedAccessControl(Map.of(
"masterUserName", "master-user"))
.logging(Map.of(
"auditLogEnabled", true,
"slowSearchLogEnabled", true,
"appLogEnabled", true,
"slowIndexLogEnabled", true))
.build();
UltraWarm nodes can be enabled to provide a cost-effective way to store large amounts of read-only data.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Object domain = Domain.Builder.create(this, "Domain")
.version(es.ElasticsearchVersion.getV7_9())
.capacity(Map.of(
"masterNodes", 2,
"warmNodes", 2,
"warmInstanceType", "ultrawarm1.medium.elasticsearch"))
.build();
Custom endpoints can be configured to reach the ES domain under a custom domain name.
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
Domain.Builder.create(stack, "Domain")
.version(ElasticsearchVersion.getV7_7())
.customEndpoint(Map.of(
"domainName", "search.example.com"))
.build();
It is also possible to specify a custom certificate instead of the auto-generated one.
Additionally, an automatic CNAME-Record is created if a hosted zone is provided for the custom endpoint
Copyright © 2021. All rights reserved.