0

Everyone does anyone have an idea of how to use AWS AppConfig with the AWS SDK PHP. My Particular use case is, I am running a simple PHP app on the EC2 instance and want to receive the JSON configurations written in the AppConfig.

use Aws\AppConfig\Exception\AppConfigException;
use Aws\AppConfig\AppConfigClient;

$appConfigClient = new AppConfigClient(['version' => 'latest', 'region' => 'ap-south-1']);
$clientid  = uniqid('', true);
$params = [
    'Application' => $APP_CONFIG_APP,
    'ClientId' => $clientid,
    'Configuration' => $APP_CONFIG_CONFIGURATION_PROFILE,
    'Environment' => $APP_CONFIG_ENVIRONMENT
];

$response = $appConfigClient->getConfiguration($params);
$config = $response['Content'];

Also, I am authorizing with the AppConfig by an Administrator IAM Role Provided so, no issues on that side and I am able to get the following output

{ "Content": {}, "ConfigurationVersion": "1", "ContentType": "application\/octet-stream", "@metadata": { "statusCode": 200, client_id=60696", and some more fields...}

But the issue is I am not getting the AppConfig Content but able to extract the metadata regarding the Data. So, Anyone who had tried this please help me out here.

raj
  • 141
  • 2
  • 4

1 Answers1

1

I haven't used AppConfig yet but am reading up about it at the minute.

If you look at the information in the 'Important' box on the page linked below then it says that the content section is not returned if there is no change to the appconfig data.

So maybe the original request had data but then any subsequent request is not detecting a change and therefore not sending any content through

It is probably worth updating the data in AppConfig and then running a new request to see if the content is populated as required.

See: https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-retrieving-the-configuration.html

T1ckL35
  • 11
  • 2