A generic prototype for a primarily event-driven platform based on AWS using serverless technologies.
- An API gateway(v2) instance and stage with its URL and available routes exported (see
pulumi uporpulumi stack outputoutput) - An event bus with a single rule for a single Lambda function that echoes received messages from the given source to CloudWatch logs
- Automatic resource tagging (for resources that support it) by domain, environment and Pulumi project ID
This repo uses Python 3.7 for application code and Pulumi for developing infrastructure as code. For more information on setting these up, see:
You'll also need to have an AWS account with CLI access. See:
In this project, use of Pulumi involves use of their Pulumi Service backend, which means you'll need an account there as well. This service manages stack changes that you trigger from the CLI (or that we trigger via later CI/CD operations) and provides a nice UI to view changes to stacks.
Follow the above prerequisite steps, then run pulumi up. This should run pip locally to download dependencies to your local virtual environment and then stand up the infrastructure in your configured AWS account (if you choose to do so).
Be wary of deploying to prod! Pulumi will tell you what it's going to deploy with a preview before you tell it to proceed, and it will error on logical name collisions with existing resources. Nevertheless, it's safer to deploy into a separate AWS account until you know what you're doing.
- You should consider adding a reusable component for creating an EventBridge Pipe that reads from SQS. This pattern will come up at least once in the future. See https://www.pulumi.com/docs/intro/concepts/resources/components/ for how to do so.
- Consider refactoring /ttc/init.py to not be so flat, and maybe create an enumeration of event sources and event schema definitions to prevent discrepancies
- If you want to add infrastructure specific to another domain, like ecom's event bus and related functions, create a new Python package under something like /ecom and follow the same pattern under /ttc. Pulumi can attempt to import existing resources to the active stack with
pulumi import. - Configure new stacks for your deployment environments with
pulumi init - Add some tests to the packages with
pytestandbehaveto get some CI going for your Lambda functions