A lambda function that keeps the offer schedules within SFMC up to date by listenerning to events triggered when changes are made to Offers or Offers are added to/drop off the website.
Ensure that you have version 2 of the aws cli client installed, if not install here
- aws cli v2 - ensure you get the correct package for you OS
Ensure that you have the correct aws creds set up and your aws2 cli tool is working
To set the configuration at function creation time alter the config.json file
To alter the configuration once the function is running alter the update.json file
$ bash updateFunction.bash
This will update the configuration and the code being executed by the lambda function.
$ bash createFunction.bash
To rollback to a older version of the code revert the to that version within github, then run the update function command.
$ aws2 lambda delete-function --function-name fn-sfmc-schedules
To invoke the function and get the output of that function into a file called testing.txt run:
$ aws2 lambda invoke --function-name fn-sfmc-schedules --log-type Tail testing.txt
Then to view the output
$ cat testing.txt
Or if you love json query this can be done in one step
$ aws2 lambda invoke --function-name fn-sfmc-schedules --log-type Tail /dev/null | jq -r '.LogResult' | base64 --decode
$ aws2 logs tail /aws/lambda/fn-sfmc-schedules --follow
This will tail the aws cloudwatch log group for this function. log groups are automatically made for each lambda function and follow this syntax /aws/lambda/${function-name}
To gain better understanding of logging run:
# aws2 logs help