- Más nuevo
- Más votos
- Más comentarios
The AI suggestion above did not work (It also generated a json which didn't pass the schema validation). However it got me to try to deploy with an attribute constraint included. And it worked! So for posterity this is the proper JSON format:
{
"version": "1",
"flags": {
"flagOne": {
"name": "Flag One",
"attributes": {
"test": {
"description": "This is a test attribute",
"constraints": {
"type": "string"
}
}
}
},
"flagTwo": {
"name": "Flag Two"
}
},
"values": {
"flagOne": {
"enabled": true,
"test": "10"
},
"flagTwo": {
"enabled": true
}
}
}
A constraint is REQUIRED in the attribute field for the CDK to deploy however a description is not required. The JSON schema here: https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-type-reference-feature-flags.html is therefore slightly wrong and should be updated by AWS engineers.
The issue you're encountering with the "Invalid 'Content' data" error when deploying a HostedConfiguration using CDK is likely related to how you've structured the attributes in your feature flag configuration.
In AWS AppConfig, feature flag attributes are properties associated with flags to express related information. However, the way you've defined the attributes in your JSON configuration doesn't match the expected format.
To correctly include attributes in your feature flags, you should structure them as key-value pairs directly under each flag, rather than nested under an "attributes" object. Also, the attribute values should be of the supported types (string, number, boolean, string array, or number array), not objects.
Here's how you could modify your JSON configuration to include attributes correctly:
{ "version": "1", "flags": { "flagOne": { "name": "Flag One", "test": { "description": "This is a test attribute", "constraints": { "type": "STRING" } } }, "flagTwo": { "name": "Flag Two" } }, "values": { "flagOne": { "enabled": true, "test": "10" }, "flagTwo": { "enabled": true } } }
In this corrected version, the "test" attribute is directly under "flagOne", and includes a "constraints" field to specify its type. The "values" section remains the same, where you set the actual value for the "test" attribute.
Remember that attribute names must be unique for a given flag, and the word "enabled" is reserved and cannot be used as an attribute name.
By structuring your feature flag configuration in this way, you should be able to successfully deploy your HostedConfiguration using CDK with attributes in your feature flags.
Sources
Creating a feature flag configuration profile in AWS AppConfig - AWS AppConfig
Creating feature flags and free form configuration data in AWS AppConfig - AWS AppConfig
Contenido relevante
- preguntada hace 12 días
- preguntada hace 12 días
- preguntada hace 8 meses
- OFICIAL DE AWSActualizada hace 2 años

Your suggestion did not work as written, however it got me to try also including a constraint, which I'll explain in a post.