Package: aws-solutions-constructs.aws-dynamodbstreams-lambda-elasticsearch-kibana
aws-dynamodbstreams-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_dynamodbstreams_elasticsearch_kibanaTypescript@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibanaJavasoftware.amazon.awsconstructs.services.dynamodbstreamslambdaelasticsearchkibanaOverviewThis AWS Solutions Construct implements Amazon DynamoDB table with stream, 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{DynamoDBStreamsToLambdaToElasticSearchAndKibana,DynamoDBStreamsToLambdaToElasticSearchAndKibanaProps}from'@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana';import*aslambdafrom'aws-cdk-lib/aws-lambda';constconstructProps:DynamoDBStreamsToLambdaToElasticSearchAndKibanaProps={lambdaFunctionProps:{code:lambda.Code.fromAsset(`lambda`),runtime:lambda.Runtime.NODEJS_16_X,handler:'index.handler'},domainName:'test-domain',//TODO:EnsuretheCognitodomainnameisgloballyuniquecognitoDomainName:'globallyuniquedomain'+Aws.ACCOUNT_ID};newDynamoDBStreamsToLambdaToElasticSearchAndKibana(this,'test-dynamodbstreams-lambda-elasticsearch-kibana',constructProps);Pythonfromaws_solutions_constructs.aws_dynamodbstreams_lambda_elasticsearch_kibanaimportDynamoDBStreamsToLambdaToElasticSearchAndKibana,DynamoDBStreamsToLambdaToElasticSearchAndKibanaPropsfromaws_cdkimport(Stack,aws_lambdaas_lambda,Aws,)fromconstructsimportConstructDynamoDBStreamsToLambdaToElasticSearchAndKibana(self,'test-dynamodbstreams-lambda-elasticsearch-kibana',lambda_function_props=_lambda.FunctionProps(code=_lambda.Code.from_asset('lambda'),runtime=_lambda.Runtime.PYTHON_3_9,handler='index.handler'),domain_name='test-domain',# TODO: Ensure the Cognito domain name is globally uniquecognito_domain_name='globallyuniquedomain'+Aws.ACCOUNT_ID)Javaimportsoftware.constructs.Construct;importsoftware.amazon.awscdk.Aws;importsoftware.amazon.awscdk.Stack;importsoftware.amazon.awscdk.StackProps;importsoftware.amazon.awscdk.services.lambda.*;importsoftware.amazon.awscdk.services.lambda.Runtime;importsoftware.amazon.awsconstructs.services.dynamodbstreamslambdaelasticsearchkibana.*;newDynamoDBStreamsToLambdaToElasticSearchAndKibana(this,"test-dynamodb-stream-lambda-elasticsearch-kibana",newDynamoDBStreamsToLambdaToElasticSearchAndKibanaProps.Builder().lambdaFunctionProps(newFunctionProps.Builder().runtime(Runtime.NODEJS_16_X).code(Code.fromAsset("lambda")).handler("index.handler").build()).domainName("test-domain").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.dynamoTableProps?dynamodb.TablePropsOptional user provided props to override the default props for DynamoDB TableexistingTableInterface?dynamodb.ITableExisting instance of DynamoDB table object or interface, providing both this anddynamoTablePropswill cause an error.dynamoEventSourceProps?aws-lambda-event-sources.DynamoEventSourcePropsOptional user provided props to override the default props for DynamoDB Event SourceesDomainProps?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 Domain.deploySqsDlqQueue?booleanWhether to deploy a SQS dead letter queue when a data record reaches the Maximum Retry Attempts or Maximum Record Age, its metadata like shard ID and stream ARN will be sent to an SQS queue.sqsDlqQueueProps?sqs.QueuePropsOptional user provided properties for the SQS dead letter queuecreateCloudWatchAlarms?booleanWhether to create recommended CloudWatch alarmsexistingVpc?ec2.IVpcAn existing VPC in which to deploy the construct. Providing both this andvpcPropsis an error.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.vpcProps?ec2.VpcPropsOptional user-provided properties to override the default properties for the new VPC.enableDnsHostnames,enableDnsSupport,natGatewaysandsubnetConfigurationare set by the Construct, so any values for those properties supplied here will be overridden. IfdeployVpc?is nottruethen this property will be ignored.Pattern PropertiesNameTypeDescriptiondynamoTableInterfacedynamodb.ITableReturns an instance of dynamodb.ITable created by the constructdynamoTable?dynamodb.TableReturns an instance of dynamodb.Table created by the construct. IMPORTANT: If existingTableInterface was provided in Pattern Construct Props, this property will beundefinedlambdaFunctionlambda.FunctionReturns an instance of lambda.Function created by the constructuserPoolcognito.UserPoolReturns an instance of cognito.UserPool created by the constructuserPoolClientcognito.UserPoolClientReturns an instance of cognito.UserPoolClient created by the constructidentityPoolcognito.CfnIdentityPoolReturns an instance of cognito.CfnIdentityPool created by the constructelasticsearchDomainelasticsearch.CfnDomainReturns an instance of elasticsearch.CfnDomain created by the constructelasticsearchDomainiam.RoleReturns an instance of iam.Role created by the construct for elasticsearch.CfnDomaincloudwatchAlarms?cloudwatch.Alarm[]Returns a list of cloudwatch.Alarm created by the constructvpc?ec2.IVpcReturns an instance of the VPC created by the pattern, ifdeployVpc?istrue, orexistingVpc?is provided.Lambda FunctionThis pattern requires a lambda function that can post data into the Elasticsearch from DynamoDB stream. A sample function is providedhere.Default settingsOut of the box implementation of the Construct without any override will set the following defaults:Amazon DynamoDB TableSet the billing mode for DynamoDB Table to On-Demand (Pay per request)Enable server-side encryption for DynamoDB Table using AWS managed KMS KeyCreates a partition key called 'id' for DynamoDB TableRetain the Table when deleting the CloudFormation stackEnable continuous backups and point-in-time recoveryAWS Lambda FunctionConfigure limited privilege access IAM role for Lambda functionEnable reusing connections with Keep-Alive for NodeJs Lambda functionEnable X-Ray TracingEnable Failure-Handling features like enable bisect on function Error, set defaults for Maximum Record Age (24 hours) & Maximum Retry Attempts (500) and deploy SQS dead-letter queue as destination on failureSet Environment VariablesAWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)Amazon CognitoSet password policy for User PoolsEnforce the advanced security mode for User PoolsAmazon Elasticsearch ServiceDeploy best practices CloudWatch Alarms for the Elasticsearch DomainSecure the Kibana dashboard access with Cognito User PoolsEnable server-side encryption for Elasticsearch Domain using AWS managed KMS KeyEnable node-to-node encryption for Elasticsearch DomainConfigure the cluster for the Amazon ES domainArchitecture© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.