This section includes feature flag samples you can use with AWS AppConfig Agent in local development mode. Local development mode expects feature flag data in the data's retrieval-time format. Retrieval-time format is the format returned when the flag is retrieved from the GetLatestConfiguration API, which only contains the flag's value. Retrieval-time format doesn't include a flag's complete definition (as passed to the CreateHostedConfigurationVersion API). The complete definition for a flag also contains information such as attribute names and values, constraints, and the flag's enabled state.
Basic
feature flag samples
Use the following basic feature flag samples with AWS AppConfig Agent in local development mode.
Note
If you want the agent to report the content type of your local feature flag data
as application/json
(as it would when retrieving flag data from AWS AppConfig in
an environment that isn't local development mode), your local feature flag files must
use the .json extension. For example,
Local:MyFeatureFlags:SampleB1.json
.
Sample 1: A single flag representing a UI refresh.
{
"ui_refresh": {
"enabled": true,
"new_styleguide_colors": true
}
}
Sample 2: Multiple flags representing operational feature flags.
{
"background_worker": {
"enabled": true,
"num_threads": 4,
"queue_name": "MyWorkQueue"
},
"emergency_shutoff_switch": {
"enabled": false
},
"logger_settings": {
"enabled": true,
"level": "INFO"
}
}
Multi-variant feature flag samples
The retrieval-time format of a feature flag configuration that contains at least one
multi-variant feature flag is represented as Amazon Ion
In order for the agent to properly interpret these files, your local feature flag
files must use the following extension:
.application%ion%type=AWS.AppConfig.FeatureFlags
. For example,
Local:MyFeatureFlags:SampleMV1.application%ion%type=AWS.AppConfig.FeatureFlags
.
Sample 1: A multi-variant flag representing a tiered release of a new feature.
'tiered_release'::[
[
(or (and (eq $group "Tier1") (split by::$userId pct::1 seed::"2025.01.01")) (and (eq $group "Tier2") (split by::$userId pct::7 seed::"2025.01.01"))),
'''{"_variant": "ShowFeature", "enabled": true}'''
],
'''{"_variant": "HideFeature", "enabled": false}'''
]
Sample 2: Multiple flags representing different UX displays based on the user’s ID. The first two flags are multi-variant and the final flag is basic.
'colorway'::[
[
(contains $userId "beta"),
'''{"_variant": "BetaTesters", "enabled": true, "background": "blue", "foreground": "red"}''',
],
[
(split by::$userId pct::10),
'''{"_variant": "SplitRollOutRedAndBlue", "enabled": true, "background": "blue", "foreground": "red"}''',
],
'''{"_variant": "default", "enabled": true, "background": "green", "foreground": "green"}''',
]
'simple_feature'::[
[
(contains $userId "beta"),
'''{"_variant": "BetaTesters", "enabled": true}'''
],
'''{"_variant": "default", "enabled": false}'''
]
'button_color'::'''{"enabled": true, "color": "orange"}'''