Passing parameters to AWS Lambda
You can pass ES cluster endpoint to Lambda function as an environment variable. Here is a snippet of CloudFormation template for such function:
"mylambda": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Handler": "index.handler",
"Role": { "Fn::GetAtt" : ["LambdaExecutionRole", "Arn"] },
"Code": {
"S3Bucket": "my-lambda-functions-bucket",
"S3Key": "mylambda.zip"
},
"Runtime": "nodejs4.3",
"Timeout": "25",
"Environment": {
"Variables": {
"ESENDPOINT": { "Fn::GetAtt": ["ESDOMAINRESOURCE", "DomainEndpoint"] }
}
}
}
}