Package: aws-solutions-constructs.aws-lambda-elasticsearch-kibana
aws-lambda-elasticsearch-kibana module---All classes are under active development and subject to non-backward compatible changes or removal in any
future version. These are not subject to theSemantic Versioningmodel.
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.Reference Documentation:https://docs.aws.amazon.com/solutions/latest/constructs/LanguagePackagePythonaws_solutions_constructs.aws_lambda_elasticsearch_kibanaTypescript@aws-solutions-constructs/aws-lambda-elasticsearch-kibanaJavasoftware.amazon.awsconstructs.services.lambdaelasticsearchkibanaOverviewThis AWS Solutions Construct implements an AWS Lambda function and Amazon Elasticsearch Service with the least privileged permissions.Some cluster configurations (e.g VPC access) require the existence of theAWSServiceRoleForAmazonElasticsearchServiceService-Linked Role in your account.You will need to create the service-linked role using the AWS CLI once in any account using this construct (it may have already been run to support other stacks):aws iam create-service-linked-role --aws-service-name es.amazonaws.comHere is a minimal deployable pattern definition:Typescriptimport{Construct}from'constructs';import{Stack,StackProps,Aws}from'aws-cdk-lib';import{LambdaToElasticSearchAndKibana}from'@aws-solutions-constructs/aws-lambda-elasticsearch-kibana';import*aslambdafrom"aws-cdk-lib/aws-lambda";constlambdaProps:lambda.FunctionProps={code:lambda.Code.fromAsset(`lambda`),runtime:lambda.Runtime.NODEJS_16_X,handler:'index.handler'};newLambdaToElasticSearchAndKibana(this,'sample',{lambdaFunctionProps:lambdaProps,domainName:'testdomain',//TODO:EnsuretheCognitodomainnameisgloballyuniquecognitoDomainName:'globallyuniquedomain'+Aws.ACCOUNT_ID});Pythonfromaws_solutions_constructs.aws_lambda_elasticsearch_kibanaimportLambdaToElasticSearchAndKibanafromaws_cdkimport(aws_lambdaas_lambda,Aws,Stack)fromconstructsimportConstructlambda_props=_lambda.FunctionProps(code=_lambda.Code.from_asset('lambda'),runtime=_lambda.Runtime.PYTHON_3_9,handler='index.handler')LambdaToElasticSearchAndKibana(self,'sample',lambda_function_props=lambda_props,domain_name='testdomain',# TODO: Ensure the Cognito domain name is globally uniquecognito_domain_name='globallyuniquedomain'+Aws.ACCOUNT_ID)Javaimportsoftware.constructs.Construct;importsoftware.amazon.awscdk.Stack;importsoftware.amazon.awscdk.StackProps;importsoftware.amazon.awscdk.Aws;importsoftware.amazon.awscdk.services.lambda.*;importsoftware.amazon.awscdk.services.lambda.Runtime;importsoftware.amazon.awsconstructs.services.lambdaelasticsearchkibana.*;newLambdaToElasticSearchAndKibana(this,"sample",newLambdaToElasticSearchAndKibanaProps.Builder().lambdaFunctionProps(newFunctionProps.Builder().runtime(Runtime.NODEJS_16_X).code(Code.fromAsset("lambda")).handler("index.handler").build()).domainName("testdomain")// TODO: Ensure the Cognito domain name is globally unique.cognitoDomainName("globallyuniquedomain"+Aws.ACCOUNT_ID).build());Pattern Construct PropsNameTypeDescriptionexistingLambdaObj?lambda.FunctionExisting instance of Lambda Function object, providing both this andlambdaFunctionPropswill cause an error.lambdaFunctionProps?lambda.FunctionPropsUser provided props to override the default props for the Lambda function.esDomainProps?elasticsearch.CfnDomainPropsOptional user provided props to override the default props for the Elasticsearch ServicedomainNamestringDomain name for the Cognito and the Elasticsearch ServicecognitoDomainName?stringOptional Cognito Domain Name, if provided it will be used for Cognito Domain, and domainName will be used for the Elasticsearch DomaincreateCloudWatchAlarms?booleanWhether to create recommended CloudWatch alarmsdomainEndpointEnvironmentVariableName?stringOptional Name for the ElasticSearch domain endpoint environment variable set for the Lambda function.existingVpc?ec2.IVpcAn optional, existing VPC into which this pattern should be deployed. When deployed in a VPC, the Lambda function will use ENIs in the VPC to access network resources. If an existing VPC is provided, thedeployVpcproperty cannot betrue. This usesec2.IVpcto allow clients to supply VPCs that exist outside the stack using theec2.Vpc.fromLookup()method.vpcProps?ec2.VpcPropsOptional user provided properties to override the default properties for the new VPC.enableDnsHostnames,enableDnsSupport,natGatewaysandsubnetConfigurationare set by the pattern, so any values for those properties supplied here will be overridden. IfdeployVpcis nottruethen this property will be ignored.deployVpc?booleanWhether to create a new VPC based onvpcPropsinto which to deploy this pattern. Setting this to true will deploy the minimal, most private VPC to run the pattern:One isolated subnet in each Availability Zone used by the CDK programenableDnsHostnamesandenableDnsSupportwill both be set to trueIf this property istruethenexistingVpccannot be specified. Defaults tofalse.Pattern PropertiesNameTypeDescriptionlambdaFunctionlambda.FunctionReturns an instance oflambda.Functioncreated by the constructuserPoolcognito.UserPoolReturns an instance ofcognito.UserPoolcreated by the constructuserPoolClientcognito.UserPoolClientReturns an instance ofcognito.UserPoolClientcreated by the constructidentityPoolcognito.CfnIdentityPoolReturns an instance ofcognito.CfnIdentityPoolcreated by the constructelasticsearchDomainelasticsearch.CfnDomainReturns an instance ofelasticsearch.CfnDomaincreated by the constructelasticsearchRoleiam.RoleReturns an instance ofiam.Rolecreated by the construct forelasticsearch.CfnDomaincloudwatchAlarms?cloudwatch.Alarm[]Returns a list ofcloudwatch.Alarmcreated by the constructvpc?ec2.IVpcReturns an interface on the VPC used by the pattern (if any). This may be a VPC created by the pattern or the VPC supplied to the pattern constructor.Lambda FunctionThis pattern requires a lambda function that can post data into the Elasticsearch. A sample function is providedhere.Default settingsOut of the box implementation of the Construct without any overrides will set the following defaults:AWS Lambda FunctionConfigure limited privilege access IAM role for Lambda functionEnable reusing connections with Keep-Alive for Node.js Lambda functionEnable X-Ray TracingSet Environment Variables(default) DOMAIN_ENDPOINTAWS_NODEJS_CONNECTION_REUSE_ENABLEDAmazon CognitoSet password policy for User PoolsEnforce the advanced security mode for User PoolsAmazon Elasticsearch ServiceDeploy best practices CloudWatch Alarms for the Elasticsearch Service domainSecure the Kibana dashboard access with Cognito User PoolsEnable server-side encryption for the Elasticsearch Service domain using AWS managed KMS KeyEnable node-to-node encryption for the Elasticsearch Service domainConfigure the cluster for the Elasticsearch Service domainArchitecture© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.