Sync active regions from lookup tables via Python
Recipe ToolsDeveloper ToolMarketing
What it does
When a function call arrives, this automation retrieves service configuration from two lookup tables and runs Python code to identify active environment regions. It returns a list of regions grouped by environment type so downstream systems have current data.
Who it's for
Engineering teams who need to keep active region lists synchronized across services without manual updates.
How teams use this
Keep prod and staging regions in sync
Automatically pull active regions from ConfigRegistry Data and separate them by environment so prod and staging deployments always reference the correct region list without manual intervention.
Route requests to the right environment
Extend this automation to include routing logic that filters incoming requests by environment type, so traffic goes to the correct prod or staging service instance based on active regions.
Alert when regions become inactive
Add snapshot storage and comparison to detect when any prod or staging regions drop off the active list, then notify the team so they can investigate service availability issues.
How it works
- Receive a function call. A real-time function call starts this automation with the request to sync active regions.
- Retrieve service configuration data. Look up a single entry in the SERCO Service Micros Data lookup table and SERCO Service ConfigRegistry Data lookup table to get the current configuration.
- Extract active regions by environment. Execute Python code to parse the ConfigRegistry Data and identify active environment regions. For each environment type, check if it matches prod or staging and build the microsEnvs list accordingly.
- Return the region list. Pass the diffActiveEnvs list with active regions grouped by environment type back to the caller so it can be used downstream.