Instructor: 0:00 If you've already created a function, you can jump to the 1 minute and 45 second mark. To create the function, we'll first create a new directory and then change into it. Here, we'll run amplify init to create a new Amplify project.
0:19 Next, give the project a name, an environment name and choose your default text editor. You can then choose default for the rest of the questions. When prompted for your AWS profile, choose the profile that you'd like to use.
0:48 Once the Amplify project's been initialized, we'll create a new function by running amplify add function. Here, we'll give the local resource a name, the function a name. We'll choose hello world as the function template.
1:04 Next, we'll choose yes to edit the function locally. In the function, before returning the response, we could log out the event by using console.log. Next, well save the function and deploy it by running amplify push.
1:32 Once the function has been deployed, we can run amplify console to look at the function within the amplify console. When we click on Functions, we can see logging for the function.
1:47 To enable a scheduled event, we'll search for CloudWatch in the AWS services. In CloudWatch, click on Events in the left-hand menu and then click Get Started. Here, we'll create a role that's scheduled to run every one minute by clicking by Scheduled with the fix rate of one minute.
2:11 Next, we'll click Add Target and search for the function that we just deployed. Next, we can take the default input, or we can configure a custom input by passing in JSON.
2:37 Next, click Configure Details to give the event a name. Once you've given the event a name, click Create Rule. To test this out, wait a couple of minutes, and then refresh the Amplify console to see the event information logged out to the console.