Skip to content

Latest commit

 

History

History
executable file
·
71 lines (40 loc) · 3.96 KB

File metadata and controls

executable file
·
71 lines (40 loc) · 3.96 KB

<< Lab 7 | Lab 8

Lab Guide 8 - Proactive Skill Monitoring

What you will do in this lab

You will schedule periodical test executions for your skill and set up an alarm in case tests fail.

What you will get at the end of this lab

You have learned how to set up proactive monitoring for your skill.

Prerequisites

  • Test Lambda function you deployed in Lab 4
  • S3 Test-Script bucket that was created in Lab 4
  • Number guessing skill that was deployed to your Amazon developer account in Lab 1

Instructions

8.1.) Schedule periodical executions

8.1.1. In the AWS Developer console go to Services -> CloudWatch and navigate to Rules in the left menu. Click on Create Rule.

8.1.2. Select Schedule and set the fixed rate to 3 minutes.

8.1.3. In the right hand side click on Add target and point to the reinvent-alx315-test-client Test Lambda function.

Confirm with pressing the Configure details button.

8.1.4. Set the name to test-client-run-schedule and hit Create rule (PLEASE DON'T FORGET TO DISABLE OR REMOVE THIS RULE AFTER THE LAB AS IT MIGHT GENERATE COSTS ON YOUR END)

The Test Lambda function will now execute every 3 minutes and simulates conversations like they are scripted in the YAML files stored in S3.

8.1.5. Go back to Services -> Lambda, navigate to the Test Lambda function and wait for a few minutes. In the Monitoring tab on the Lambda detail page you should notice automatic executions. The logs but also the Invocation errors dashboard tell you if the skill responses align with the assertions made in the YAML scripts. Remember, the Test Lambda function throws an error if one of those assertions is not met.

8.2.) Set alarming on test failures

As you don't want to manually look at CloudWatch metrics in order to see if your tests run smoothly, you would like to get notified instead.

8.2.1. In the AWS Developer console go to Services -> CloudWatch and navigate to Alarms. Click on Create Alarm.

8.2.2. Click on Lambda Metrics. In the search field type reinvent to better find the Test Lambda function metrics. You're looking for the Errors metric of the Lambda function reinvent-alx315-test-client.

Select it and click Next.

8.2.3. On the next page set this alarm's name to test-client-alarm. Set the threshold to Whenever Error is >= 1 for 1 consecutive periods.

8.2.4. In the Actions section click on the New list link. Set the topic name to test-client-alarm-notifications and enter your e-mail address in the E-mail list. You should have access to your mailbox in order to check if the alarm is sending out notifications.

Confirm with hitting Create Alarm

8.2.5. CloudWatch sends a confirmation to your mail and waits for your approval on sending out notifications to your mailbox. Click on the confirmation link in the mail and return to CloudWatch.

8.2.6. The last exercise is to break something. If the scripts you created during the last labs all work fine, it is now time to let a test run fail. Make an assertion in one of the YAML-files you know will go wrong, upload this file to the S3 bucket and wait for up to 3 minutes. In CloudWatch you can check if the alarm got triggered. Once this has happened, you should receive an e-mail.

8.3.) IMPORTANT! Clean up

Please don't forget to:

  • remove or disbale the CloudWatch rule you created.
  • remove or disable the CloudWatch alarm you created.

If you'd like to remove all AWS resources created in the previous labs you could also roll back and delete the CloudFormation stack. Just make sure you empty the S3 bucket before rolling it back as otherwise it will fail.

<< Lab 7 | Lab 8