Step 3: Test the Lambda function
In this step, you invoke the Lambda function manually using the invoke
command.
When the Lambda function executes, it generates a UUID and writes it to the ElastiCache cluster that you specified in your Lambda code.
The Lambda function then retrieves the item from the cache.
-
Invoke the Lambda function (
AccessMemCache
) using the Amazon Lambdainvoke
command.For Linux, OS X, or Unix:
aws lambda invoke \ --function-name AccessMemCache \ --region us-east-1 \ output.txt
For Windows:
aws lambda invoke ^ --function-name AccessMemCache ^ --region us-east-1 ^ output.txt
-
Verify that the Lambda function executed successfully as follows:
Review the output.txt file.
Verify the results in CloudWatch Logs by opening the CloudWatch
console and choosing the log group for your function ( /aws/lambda/AccessMemcached
). The log stream should contain output similar to the following:Success: Inserted 05fcf2e4d6c942209acc89ea79b5b15e. Fetched 05fcf2e4d6c942209acc89ea79b5b15e from Memcached.
Review the results in the Amazon Lambda console.