An Introduction to Feature Toggles & AWS AppConfig
Tags: aws, appconfig, config, featuretoggles
Published: 2022-04-15 14:45:22

> Rollout changes with confidence using feature toggles.

This article’s goal is to explain feature toggles and how engineering teams can benefit from using them. It will also provide a brief introduction about AWS AppConfig and how it could be used to create and manage configuration & feature toggles dynamically during runtime.

## Feature Toggling

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jhq9ddz809yby8gcmbq.png)

Feature Toggles (aka Feature Flags) are used by engineering teams to dynamically enable/disable software behavior during runtime. This empowers them to continuously deploy an entire application stack which could include untested, upcoming, or features subjected for evaluation in production without actually releasing them to their consumers.

Feature toggles greatly contributes to reducing the risk of application-level failures & downtimes when new software features are rolled out to production environments. This is achieved through the dynamic enabling/disabling (Toggling) of software features during runtime using intuitive configuration management tools like AWS AppConfig.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o9rh5bq2a2eqdpnwbp03.png)

Testing features in production is might sound crazy but there are certain situations where feature testing is only meaningful inside the context of a production environment due to the nature of traffic or amount of data in this environment.

To give an example, let’s say a shoe-string startup’s engineering team recently released an integration with a 3rd party provider’s API and they never had a chance to test the integration under stress inside staging environments due to the fact that they are using pay-per-use compute environments like AWS Lambda. Running a stress test certainly results to a sudden surge of bill and would be considered as an inefficient use of valuable compute budget.

Solving the mentioned problem requires the team to avoid load testing in staging environment to ensure efficient usage of compute budget and this could be achieved by testing the API integration inside a live production environment.

To solve this problem in an efficient and less risky manner, feature toggles could be utilized by the team to modify the application’s behavior inside production runtime by turning on the feature toggle so the integration could be included in the normal application routine.

Feature toggles enables engineering teams to observe the 3rd party API’s behavior in a live production environment and provides them the capability to disable the API integration if any throttling issues are encountered without performing a lengthy deployment.

## Benefits

The use-case mentioned above is just the tip of the benefit iceberg, there are several ways in which engineering teams could take advantage of feature toggles:

- Deploy invisible features with risk mitigation in-place. This is great for software features that could only be evaluated in production environments due to either the amount of traffic or data required to evaluate their working conditions.
- Since engineering teams can deliver software features regardless of their validity, it would be safe for us to say that feature toggles greatly increases an engineering team’s agility.
- Product managers now have the capability to run A/B tests on production without the need for complex traffic segmentation tools that often makes the production applications bloated.
- Engineering teams can work on a single branch and push all code regardless if they are working or not which greatly increases an engineering team’s speed in delivering software features in production environments.
- Feature toggles offer flexibility to engineering teams by providing them means of testing assumptions that couldn’t be easily proven in development environments.
- Modify mobile application behaviors without resubmitting new app store and play store builds. We all know how long does it take for Apple and Google to update our mobile applications which adds another layer of complexity in testing / evaluating ideas against customer behaviors.

## Use-cases

- Deploy applications that requires easy customization for different countries/locales using a central code-base. This is super convenient for large multi national companies who need to design applications for different regulations and cultures of their target markets.
- Enable / disable new features based on customer reactions and collected insights.
- Swap out different machine learning models or alter their configurations based on observed performance in actual production environments and inferencing results they produce.
- Enable/disable integration with 3rd party capabilities like Emails, SMSs, crypto wallets, analytical APIs, web hooks, etc.
Dark launching of new business capabilities. (Dark launching is the capability to deploy software features without immediate unveiling them to customers)

This are the few ones that I could think of as we speak, I would be more interested in hearing your ideas and would love to have a chat with you guys in the comments section about your thoughts regarding feature toggles.



## Feature Toggling Services

Feature toggling services like AWS AppConfig offers benefits that hard-coded configuration / JSON files or open source tools can’t offer:

- Central management of feature flags inside easy to use GUIs.
- Instant switching of features during runtime.
- Eliminates the need to worry about the stability, continuity and sustainability of an open-source project.
- Focus engineering efforts towards building differentiating capabilities over developing feature toggling capabilities.
- You get to audit usage data of feature toggles without building analytical capabilities on your own.

## AWS AppConfig

![AWS AppConfig Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgo0tyxitb6lpzq6f5vz.png)

AppConfig is a service offered by AWS for the purpose of centralizing management of configuration data. It helps us store feature flag values and other configuration data so we don’t have to embed configuration data inside our codebases or build our own feature flag management tools.


![Application and Environment Constructs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ahgmmxl1bx5zkqsidqiw.png)

AWS AppConfig also includes the capability to group related configuration through the use of [application ](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_Application.html) & [environment](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/API_Environment.html) constructs which makes configuration management simpler.


![Sample ML Inferencing Configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/008likazi5bk452jrcjd.png)

AWS AppConfig comes with configuration validators that acts as an additional set of safety measures geared towards reducing the number of configuration errors originating from invalid and faulty values.

![Deployment tool](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpveibbtcdiqfd8vjd3p.png)

The service also comes with ready-to-use deployment tool that streamlines the management of feature flags during application runtime. This tool includes several deployment strategies which makes AWS AppConfig shine better compared to other feature toggling tools out there.


![Deployment Strategies](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d2131bjavkuvacmlr5va.png)

It also includes a monitoring tool integrated to AWS CloudWatch that we could use to monitor and observe the impact of feature toggles without exerting too much effort.


![Monitoring via CloudWatch Alarms](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bmy3xd4arp8gq8nllb1v.png)

AWS AppConfig is compatible with applications hosted on EC2, AWS Lambda, container services, mobile applications or IOT devices.


## Conclusion
Feature toggles enable software engineering teams to enable/disable new software features. It empowers product owners too by providing the capability to test out assumptions and ideas without taking the risk of annoying customers in production environments. AWS AppConfig is an awesome tool that AWS customers could use to get started with feature toggling.



## Stay tune for more AWS AppConfig articles

I’m currently working on a few more articles aimed at helping developers in provisioning, testing and integrating AWS AppConfig on different layers of serverless applications. If you have any use-cases that you’d like to try using AWS AppConfig, feel free to drop a comment here and let’s see how could we collaborate together to implement a proof of concept with other AWS community builders.

## Further Learning
Here are some articles and videos that everybody could use to learn more about AWS AppConfig.

- AppConfig User Guide [[Link]](https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html)
- AppConfig API Reference [[Link]](https://docs.aws.amazon.com/appconfig/2019-10-09/APIReference/Welcome.html)
- AppConfig Introduction Video [[Link]](https://www.youtube.com/watch?v=rL_e6W6SlMM)
- AppConfig Getting Started Video [[Link]](https://www.youtube.com/watch?v=ztIxMY3IIu0)