Step 3: Test the Lambda function - Amazon MemoryDB for Redis
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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 cache that you specified in your Lambda code. The Lambda function then retrieves the item from the cache.

  1. Invoke the Lambda function (AccessMemoryDB) using the Amazon Lambda invoke command.

    aws lambda invoke \ --function-name AccessMemoryDB \ --region us-east-1 \ output.txt
  2. 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/AccessRedis). The log stream should contain output similar to the following:

      Success: Inserted 826e70c5f4d2478c8c18027125a3e01e. Fetched 826e70c5f4d2478c8c18027125a3e01e from MemoryDB.
    • Review the results in the Amazon Lambda console.