This repo contains an AWS Serverless application using CDK to define the Infrastructure, written in C#. This defines an application that will deploy an API and CRUD code to allow feature flags to be created, retrieved, updated and delete using DynamoDB as storage.
Each action on the api has basic validation which includes verifying the flagNAme is in the the path and that flagName and value are in the request body where applicable.
- User creates a feature flag via the api using a POST request
- API Gateway invokes a lambda using a proxy integration
- The handler of the Create lambda queries DynamoDB to ensure flag does not exist, if it does an error is returned.
- If flag does not exist feature flag name and value is saved in DynamoDB
- User retrieves a feature flag via the api using a GET request
- API Gateway invokes a lambda using a proxy integration
- The handler of the Get lambda queries DynamoDB to retrieve the flag.
- If flag does not exist an error is returned otherwise a successful response including name and value are returned.
- User updates a feature flag via the api using a PUT request
- API Gateway invokes a lambda using a proxy integration
- The handler of the Update lambda queries DynamoDB to ensure flag exists, if it does not exist an error is returned.
- If flag does exist feature flag value is updated and saved in DynamoDB
- User deletes a feature flag via the api using a DELETE request
- API Gateway invokes a lambda using a proxy integration
- The handler of the Delete lambda queries DynamoDB to ensure flag exists, if it does not an error is returned.
- If flag does exist feature flag is deleted from DynamoDB.
The cdk.json
file contains the information needed for the CDK Toolkit to execute your app.
Running the deploy.bat will deploy this application.
Beware! This is a prototype of how a feature flag service can be ran using serverless and CDK, this is not intended for production use as this has no authentication and only basic validation.