AWS AppConfig
Overview
AWS AppConfig is a Continuous Configuration tool offered by AWS that enables developers to apply different configurations across their applications without modifying application code. AWS AppConfig can be used to create feature flags - feature flags are like toggles and help developers remotely enable or disable certain features. AWS AppConfig can deploy configurations automatically and even roll back configurations in case of errors.
What is AWS AppConfig?
By now Continuous Integration (CI) and Continuous Deployment (CD) are widely used in the software industry. Continuous Integration enables developers to have changes in application code automatically merged, built, and prepared for deployment without any manual effort. Continuous Deployment on the other hand automatically deploys the recent changes to customers, allowing them to use the latest features of your application. AWS AppConfig offers another type of continuous flow - Continuous Configuration (CC).
AWS AppConfig is an offering from AWS that helps developers manage and deploy configurations for your applications. It helps you apply changes in application configuration from the AWS Console, monitor your application for any alarms, and automatically roll back if there are any errors - introducing Continuous Configuration in your application. AWS AppConfig is programmatically supported on AWS EC2 Instances, AWS Lambda functions, mobile apps, IoT devices, and on-premises instances. AWS AppConfig scales with your infrastructure dynamically. AWS AppConfig is part of AWS Systems Manager's tools and services.
How Does AWS AppConfig Work?
AWS AppConfig works based on three processes - configure, enable, and deploy. Let's explore each of them in detail.
- Configure: You need to configure three types of resources in AWS AppConfig:
- Application: First, you need to create an "Application" that represents your application or project. For example, if you are developing a mobile app you can create an application named "MobileApp".
- Environment: Secondly, you need to create "Environments" that represent logical independent deployments. For example, for your mobile app, you can have a "Test" environment and a "Production" environment. You can create only one environment if you do not require multiple environments.
- Configuration Profile: Finally, you need to create "Configuration Profiles" that define your configurations. This can be a YAML file, JSON file, an object stored in AWS S3, or parameters in Parameter Store.
- Enable: After you have configured AWS AppConfig, you need to enable your application to continuously check for and retrieve configuration data from AWS AppConfig. This can easily be done using the AWS SDK and AWS AppConfig specific APIs.
- Deploy: After your application is set up to retrieve configurations from AWS AppConfig, then you can start to use AWS AppConfig to deploy new configuration profiles using deployment strategies. A Deployment Strategy contains the following information:
- Total amount of time for deployment to last
- The percentage of targets to retrieve a deployed configuration during each interval
- The amount of time AWS AppConfig waits for before considering the deployment as successful
Features of AWS AppConfig
The main features of AWS AppConfig are:
- Continuous Configuration: The main feature of AWS AppConfig is continuous configuration. This enables developers to separate out application code and application configurations. AWS AppConfig provides developers the tools required to configure configurations (using AWS Console or the AWS CLI), enable applications to read from AWS AppConfig (using AWS SDK), and finally deploy these configurations automatically.
- Error Validation: AWS AppConfig features automatic validation against a pre-defined schema or using an AWS Lambda function that contains the validation logic. This ensures your configuration data is syntactically and logically correct before making it available to your application, and hence prevents costly errors.
- Monitoring and Automatic Rollback: AWS AppConfig can roll out configurations either instantly or gradually. The configuration change can be monitored using AWS CloudWatch, and automatically rolled back if any pre-defined AWS CloudWatch Alarms are triggered.
Use Cases of AWS AppConfig
AWS AppConfig enables a variety of use cases, such as:
- Feature Flags: AWS AppConfig is an excellent choice if you want to introduce feature flags in your application code. A feature can be deployed to production but hidden behind a feature flag. When the feature is ready to be released, you can use AWS AppConfig to enable that feature seamlessly without the need for a new deployment.
- Operations Tuning: AWS AppConfig can be used for application or operations tuning. This involves tweaking application parameters like the number of database connections or timeout values on the fly to best tune the application performance given the current load on the application.
- Allow-Listing or Block-Listing: Another use case for AWS AppConfig is limiting features of your application to only certain users for a limited time using an "allow-list". On the other hand, you can block certain users from using some features of your application by configuring a "block-list" on AWS AppConfig.
Getting Started with AWS AppConfig
In this tutorial, we will create an example AWS AppConfig Configuration Profile and Environment. Then we will create a feature flag with a deployment strategy. This simulates how you can use AWS AppConfig to manage configurations for your application.
Pre-requisites
- AWS Account
Steps
Part 1 - Creating an AWS AppConfig Application and Environment
- log in to your AWS Account.
- Open the AWS Console. Search for "AppConfig" in the Search Bar. Select AWS AppConfig.
- Click "Get Started" to create a new AWS AppConfig Application.
- Enter a name in the Name section and click Create application.
- After the Application has been created, go to the Environments tab. Click Create environment.
- Enter a name in the Name section and click Create environment.
Part 2 - Creating a Configuration Profile and Feature Flag
- After the Environment has been created, go back to the AWS AppConfig dashboard. Go to the Configuration Profiles and Feature Flags section and click Create.
- Choose Feature Flag.
- Enter a name in the Name section and click Create feature flag configuration profile.
- After the Configuration Profile has been created, you will now be able to add feature flags. Click on Add new flag.
- Enter a name in the Name section and click Add flag.
- If you are prompted to save a new version, click on Save new version.
Part 3 - Choosing a Deployment Strategy and Deploying the Feature Flag
- Click on Start deployment.
- On the Start deployment page,
- The Staging Environment should already be selected.
- For Deployment Strategy, you can choose the AWS Recommended option. This option will gradually deploy your feature flag configuration in a 20 minutes time period.
- You can now see the configuration change progress as it is being deployed across your application.
Benefits of AWS AppConfig
Let's take a look at the benefits of using AWS AppConfig:
- Reduce Errors in Configuration Changes: You can reduce application downtime by enabling you to create rules to validate your AWS AppConfig configurations. For syntactic validation, you can define a JSON schema whereas for logical validation you can use an AWS Lambda function that contains the validation logic.
- Deploy Changes Across a Set of Targets Quickly: AWS AppConfig enables you to rapidly deploy changes across multiple AWS EC2 Instances, AWS Lambda functions, containers, mobile applications, or on-premises systems in a matter of seconds. Along with pushing the configuration, you can monitor your application using AWS CloudWatchandAWS AppConfig` can automatically roll back in case of errors.
- Update Applications Without Interruptions: With AWS AppConfig you can continuously deploy features to your application and keep them disabled using feature flags until you are ready to release these features to your customers.
- Control Deployment of Changes Across Your Application: AWS AppConfig lets you control the deployment strategy and determine how fast you want your application targets to retrieve a configuration change.
Parameter Store vs AWS AppConfig
Parameter Store is another offering under AWS Systems Manager. It provides a centralized store to manage configuration data and integrates with AWS Key Management Service (KMS).
The main difference between Parameter Store and AWS AppConfig is that Parameter Store does not support the gradual deployment of configuration changes. Once you have stored data in Parameter Store, there is no polling mechanism that ensures updated data gets propagated across your deployments.
AWS Config vs AWS AppConfig
AWS Config, despite its name, is not used to manage configurations like AWS AppConfig. It is used to continuously assess, audit, and evaluate the configurations and relationships of your AWS resources.
AWS Config is a governance tool where you can define rules for your AWS resources. AWS Config can validate if the rules you have defined are being followed and can auto-remediate the configurations back to the expected state.
AWS AppConfig Pricing
You are billed as per your usage of AWS AppConfig. There is no upfront cost for using AWS AppConfig. With AWS AppConfig, you pay each time you request configuration data from AWS AppConfig using API calls as well as each time the requesting target receives configuration data.
The pricing is as follows irrespective of the AWS Region used:
- Configuration requests via API Calls: $0.0000002 per configuration request
- Configuration received: $0.0008 per configuration received
Conclusion
- AWS AppConfig is a continuous configuration service by AWS, which lets you manage application configuration independently from application code.
- AWS AppConfig lets you create configuration profiles, enable your application to retrieve configurations, and finally deploy configurations using a deployment strategy.
- AWS AppConfig features continuous configuration management, error validation, monitoring, and automatic rollback.
- AWS AppConfig can be used for a variety of use cases like feature flags, operations tuning, and allow-lists/block-lists.
- There are many benefits of using AWS AppConfig like reducing errors in configuration changes and updating applications without interruptions.
- AWS AppConfig charges as per your usage, there is no upfront cost.