Set an alert for the number of signup user

Problem statement

Can we catch or do we have an alert for unusual behaviors, like a high volume of users being created in a low time period, for example on 19 Jan 2023 42K accounts were created within a span of 2 hours, however, our rate of the created accounts is lower than this in daily basis, please advise if we have an alert for this behavior or if we can manage one for such cases.

Solution

  • Log streaming: if you’re streaming logs to an analytics tool, you could potentially configure an alert for example when 50K successful signups are completed.
  • Extensibility: you can create a post-user registration action trigger which calls an external API that increments a counter on a database.

This doc explains how to prevent registration, just to give you an idea:

Here is an example of Action:

const axios = require("axios");
const MAX_USER_COUNT = 50000;

exports.onExecutePreUserRegistration = async (event, api) => {
const userCount = await axios.get("[https://my-api.exampleco.com/userCount"](https://my-api.exampleco.com/userCount)");
if (userCount > MAX_USER_COUNT) {
api.access.deny("Registration limit reached.", "Registration is limited to 50,000 users.")
return;
}
await axios.post("[https://my-api.exampleco.com/userSignup"](https://my-api.exampleco.com/userSignup)", { inc: 1 });
};