9 min read19 hours ago
–
Press enter or click to view image in full size
1. Introduction 2. Traditional vs. Feature Flags ∘ 2.1 Feature Flags (Configuration Management) ∘ 2.2 How It Works ∘ 2.3 Example: The Christmas Release ∘ 2.4 Other Use Cases 3. Feature Flag Tools 4. Getting Started with AWS AppConfig ∘ 4.1 Prerequisites ∘ 4.2 Create the Application ∘ 4.3 Create the Environment ∘ 4.4 Create the Configuration Profile 5. Testing with Demo Application ∘ 5.1 Deploy with first flag ∘ 5.2 Verify with AWS CLI ∘ 5.3 Testing with a Demo Python Application 6. Conclusion
1. Introduction
Back in November 2024, I had t…
9 min read19 hours ago
–
Press enter or click to view image in full size
1. Introduction 2. Traditional vs. Feature Flags ∘ 2.1 Feature Flags (Configuration Management) ∘ 2.2 How It Works ∘ 2.3 Example: The Christmas Release ∘ 2.4 Other Use Cases 3. Feature Flag Tools 4. Getting Started with AWS AppConfig ∘ 4.1 Prerequisites ∘ 4.2 Create the Application ∘ 4.3 Create the Environment ∘ 4.4 Create the Configuration Profile 5. Testing with Demo Application ∘ 5.1 Deploy with first flag ∘ 5.2 Verify with AWS CLI ∘ 5.3 Testing with a Demo Python Application 6. Conclusion
1. Introduction
Back in November 2024, I had the privilege of sharing my insightsat **AWS Community Day Myanmar 2024 **(lightning talk). It was an incredible experience connecting with such a vibrant tech community.
During the event, I presented a session titled “Modern Software Application Development on AWS Cloud.” While that talk covered CI/CD (AWS CodePipeline) and Application Deploy on ECS cluster and managed Feature Toggle with AWS AppConfig.
In this article, I want to take that concept one step further. I want to discuss Feature Toggles with AWS AppConfig. I will share how AWS AppConfig and Feature Flags can fundamentally change the way you deliver software. By mastering these tools, we can decouple deployments from releases and sleep better at night.
2. Traditional vs. Feature Flags
Normally, we write code, push it to a feature, bugfix or some branch, raise a Pull Request (PR), and once approved, we merge it. The code then flows through Staging and finally to Production.
The problem is that once we deploy to Production, users see it immediately. This creates high stakes. If the new feature has a bug, we have to rollback the entire deployment, potentially causing downtime or affecting other stable features.
2.1 Feature Flags (Configuration Management)
When we start using Feature Flags, developers first need to be aware of the Best Practices. Using flags without a plan can get messy, so we should follow guidelines such as:
- Naming Conventions: Should be clear names so everyone knows what the flag does.
- Lifecycle Management: Planning when to remove the flag.
2.2 How It Works
Once we are aware of the best practices, developers can write the feature and push the code to production. This feature can be managed by a Feature Flag tool.
Even though the code is released to production, that new feature is hidden behind a flag. We can turn it ON or OFF without redeploying the code. Bug in the new feature? We can quickly turn it off instantly.
2.3 Example: The Christmas Release
Imagine we need to release a special Christmas Theme or a holiday discount.
We can deploy the code to all environments (e.g. QA, Staging, and Production) before Christmas. We don’t need to wait for QA to finish before deploying to Production. We just deploy it everywhere.
- In Production: The flag is
OFF(users see the normal theme). - In QA/Staging: The flag is
ON(testers can verify the Christmas theme).
When Christmas day arrives, we simply turn the flag ON in Production. It is safe, instant, and stress-free.
2.4 Other Use Cases
There are many other powerful ways to use this:
- Progressive Delivery: Rolling out to 10%, then 20%, then 100% of users.
- Testing in Production (TIP): Safely testing with real data.
- A/B Testing & Experimentation: Comparing two versions of a feature.
- Trunk-Based Development: Merging code to master or main constantly without breaking the build. And you can figure out further use cases as well.
3. Feature Flag Tools
Now that we understand the concept, let’s explore the tools available for Feature Flag Tools (Configuration Management).
On the AWS Cloud, We can use AWS AppConfig as a Feature Flag Tools (which is what we will focus on this article).
And there are other feature flag tools as well.
4. Getting Started with AWS AppConfig
Press enter or click to view image in full size
4.1 Prerequisites
- Application ID
- Environment ID
- Configuration Profile ID
- We also need to ensure our application has the necessary AWS IAM permissions to perform
*appconfig:GetLatestConfiguration*and*appconfig:StartConfigurationSession*.
4.2 Create the Application
In AWS AppConfig, an Application acts as a group for our configuration settings and defines a logical namespace. It’s essentially an organizational construct, similar to a folder, for grouping configurations related to an application.
- Go to the AWS Systems Manager console and select AppConfig from the sidebar. If this is your first time using this service, click on Get Started. Otherwise, click on application.
Press enter or click to view image in full size
- Click on Create application.
Press enter or click to view image in full size
- Name: Enter a name like
DemoAppConfigorPaymentService or related name with your use case. - Description: (Optional) Add details about what this app does.
Press enter or click to view image in full size
- After creation, you will see your Application ID.
Press enter or click to view image in full size
4.3 Create the Environment
In AWS AppConfig, an Environment represents a logical grouping of the application’s deployment targets (e.g., development, staging, production). It determines where configurations are applied and how changes are tracked and managed.
- It separates deployment targets (e.g.,
Development,Staging,Production). - It determines where configurations are applied.
- It tracks changes and manages rollbacks specific to that environment.
To create one:
- Inside Application, go to the Environments tab.
- Click Create environment.
Press enter or click to view image in full size
- Name it
Staging(and repeat this step can create other e.gProduction).
Press enter or click to view image in full size
- Once created, note down the Environment ID.
Press enter or click to view image in full size
4.4 Create the Configuration Profile
A Configuration Profile is used to define where and how our configuration data is stored. It have Feature Flags and Freeform Configuration. We will use now for Feature Flags.
- Inside Application, go to the Configuration Profiles tab.
- Click Create configuration profile.
Press enter or click to view image in full size
- Select Feature Flag.
- Name: Give it a clear name, e.g., CheckoutFeatureFlags
Press enter or click to view image in full size
- Click Next > Let’s create the first flag.
Let’s set the name as
allow-mmk-at-checkoutin this scenario.
Press enter or click to view image in full size
Click on Next, then Save and Deploy Later.
Press enter or click to view image in full size
- Once created, you will get your Configuration Profile ID.
Press enter or click to view image in full size
Now we’ve got
- Application ID
- Environment ID and
- Configuration Profile ID.
5. Testing with Demo Application
5.1 Deploy with first flag
For my demo application, I need to define attributes in the Flags.
- Click on the Flag.
Press enter or click to view image in full size
- Click on define attributes.
Press enter or click to view image in full size
- Updated attributes as below and click Apply.
Press enter or click to view image in full size
Press enter or click to view image in full size
Now, Can start to deploy the flags …… Click on Start Deployment.
Press enter or click to view image in full size
Select the target Environment (e.g., Staging or Production) and the **Hosted configuration version ***(configuration profile version.) *I’ve selected the latest version (2).
Next, choose a Deployment Strategy. For this demo, I am using AppConfig.AllAtOnce (Quick) predefined strategies and we can create custom ones.
- Click on Start deployment
Press enter or click to view image in full size
Deployment #1 has started! It is now rolling out based on the configuration profile version, deployment strategy, and target environment we selected.
Press enter or click to view image in full size
5.2 Verify with AWS CLI
After deployment, we can verify the configuration directly using the AWS CLI.
Prerequisites: On your local machine, ensure you have the necessary IAM permissions to access AWS AppConfig. You may also need to specify your AWS profile or region if they are not set as default.
Step 1: Initiate a Session First, we need to start a configuration session to retrieve the data. Run the following command
aws appconfigdata start-configuration-session \ --application-identifier <APPCONFIG_APPLICATION_NAME_ID> \ --configuration-profile-identifier <APPCONFIG_CONFIG_PROFILE_NAME_ID> \ --environment-identifier <APPCONFIG_ENVIRONMENT_NAME_ID>
We will see like this. copy and save this token
Press enter or click to view image in full size
Next step to retrieve the configuration data
aws appconfigdata get-latest-configuration \ --configuration-token <start-configuration-session-token> --output json config_data.json
We can see the our configuration data
Press enter or click to view image in full size
5.3 Testing with a Demo Python Application
Try with demo app, I have prepared a simple demo application. You can clone this repository to test the AppConfig integration locally or deploy it to AWS ECS or somewhere.
Repository: https://github.com/wwwaiyan/appconfig-demo-python.git
Before running the app, you need to point it to the resources we just created. Open the .env file in the project root and update it with your specific AppConfig details:
APPCONFIG_APPLICATION_IDAPPCONFIG_ENVIRONMENT_IDAPPCONFIG_PROFILE_ID
Run this application locally. (Note: Ensure your terminal has access to valid AWS Credentials and the correct AWS Region. If your local profile lacks the correct IAM permissions or region settings, the application will fail to retrieve the configuration.)
git clone https://github.com/wwwaiyan/appconfig-demo-python.git -b feat/democd appconfig-demo-python#Update the AWS AppConfig Informationvim .envpython3 -m venv appconfigsource appconfig/bin/activateuv pip install -r requirements.txtpython3 appconfig_demo.py
Press enter or click to view image in full size
You can access it via the browser at localhost port 80. We can see on the browser that the app allows us to select the MMK Option and discount feature. This is managed by flags; the current flag is ON. In the next step, let’s turn off the flags.
Press enter or click to view image in full size
Go to the our Configuration Profile > Turn Off the Flags toggle and Save version
Press enter or click to view image in full size
We need to redeploy the appconfig for new changes
Press enter or click to view image in full size
Select new version (3) and Start Deployment
Press enter or click to view image in full size
Press enter or click to view image in full size
When the AppConfig deployment finishes, refresh the browser at localhost port 80. We can see that the MMK and discount features no longer appear. We achieved this without changing the code (without redeploy the code); it was managed entirely by the Feature Toggle using AWS AppConfig.
Press enter or click to view image in full size
Press enter or click to view image in full size
Resources: https://github.com/wwwaiyan/appconfig-demo-python.git https://docs.aws.amazon.com/appconfig/ https://docs.getunleash.io/get-started/what-is-a-feature-flag https://aws.amazon.com/blogs/mt/using-aws-appconfig-feature-flags/ https://trunkbaseddevelopment.com/
6. Conclusion
In this article, we explored Feature Flag toggles and AWS AppConfig.
We walked through creating an Application, Environment, and Feature Flag Profile, and we saw firsthand how toggling a switch in the AWS Console can instantly update a running Python application in this article.
If you are interested in details and advanced topics, you should learn about feature flags, AWS AppConfig deployment strategies, validation extensions, monitoring, and more.
I hope this article helps you get started with faster deployments with AWS AppConfig. If you have any questions, feel free to reach out to me.
For other related DevOps and cloud articles, you can check out here. https://medium.com/@wwwaiyan
Happy Learning and sharing!