Crawl the value of your Discogs Collection with AWS Lambda and log maximum
, minimum
, and median
collection values, as well as the number of items in your collection to custom CloudWatch metrics.
Additionally, this creates an HTTP endpoint /last
that returns the most recent item in your library.
{
"artist": "Lakman",
"title": "Aus Dem Schoß Der Psychose",
"year": 2016
}
$ > yarn install
Make sure to update your Discogs username in serverless.yml
or set the USERNAME
environment variable before you deploy your functions.
First create an access token for accessing the Discogs API, then use Serverless to deploy everything:
$ > TOKEN=YOUR_DISCOGS_ACCESS_TOKEN yarn deploy && yarn invoke
Serverless will configure a CloudWatch Schedule that triggers the AWS Lambda function every 10 minutes per default. Just update the serverless.yml
configuration and deploy your updated interval.
events:
- schedule: rate(10 minutes)
Feel free to use the code, it's released using the MIT license.
You are more than welcome to contribute to this project! 😘
To make sure you have a pleasant experience, please read our code of conduct. It outlines core values and believes and will make working together a happier experience.