Search code examples
amazon-web-servicesaws-app-config

How to create-hosted-configuration-version for aws appconfig


In AWS AppConfig I created application Testing and configuration profile TestingFlags. I want to create hosted configuration version using CLI.

aws appconfig create-hosted-configuration-version --application-id APP_ID --configuration-profile-id PROF_ID --content eyJ0ZXN0IjogeyJlbmFibGVkIjogZmFsc2V9fQ== --content-type "application/json" out

As a result I got the following error:

An error occurred (BadRequestException) when calling the CreateHostedConfigurationVersion operation: Error invoking extension AppConfig Feature Flags Helper: Invalid 'Content' data

P.S. eyJ0ZXN0IjogeyJlbmFibGVkIjogZmFsc2V9fQ== is the base64 decoded string {"test": {"enabled": false}}

Probably content should be structure in some specific way. I read this guide https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-configuration-and-profile.html#appconfig-creating-feature-flag-configuration-commandline

I will appreciate any help.


Solution

  • Documentation example was incorrect. Correct form is:

    aws appconfig create-hosted-configuration-version --application-id APP_ID --configuration-profile-id PROF_ID --cont
    ent BASE_64_CONTENT --content-type application/json output.json
    

    Where BASE_64_CONTENT is base64 encoded data, in a form:

    {
      "flags": {
        "flagkey": {
          "name": "flagkey"
        }
      },
      "values": {
        "flagkey": {
          "enabled": false
        }
      },
      "version": "1"
    }