Scheduled Job Config - gscooke/AlexaNissanLeaf GitHub Wiki

Scheduled Job Configuration

Go back to the management console and this time search for cloudwatch. Select it and continue.

Click 'Events' in the left menu and then click 'Create rule' on the resulting page

Select 'Schedule' instead of Event Pattern, leaving the Fixed rate of 5 minutes alone.

In the Targets section, select 'Lambda function', then in the Function* box below it, select the electric car function your created earlier.

Select 'Configure input' and then select Constant (JSON text). Enter the following information in the textbox:

{"mechanism":"scheduledUpdate","currentBatteryLevel":0,"interval":1,"timesRunInState":0,"resources":["arn:aws:events:us-east-1:123123123:rule/scheduledNissanLeafUpdate"]}

Select 'Configure Details'

Enter a name and a description, then select Create rule

Your rule should now be displayed on the Rules page.

Select your Rule and you should see a Summary page

Copy the ARN value again which will be used in the scheduledEventArn parameter for your Lambda function.

Copy the name of your rule which will be used in the scheduledEventName parameter for your Lambda function.

Now select 'Actions' and then 'Edit' at the top right of the screen, and modify the Targets Constant (JSON text) value. Replace the example ARN given above with the ARN that you just copied, then click 'Configure details' and then 'Update rule'