Retrieving configurations by directly calling APIs
Your application retrieves configuration data by first establishing a configuration session using the StartConfigurationSession API operation. Your session's client then makes periodic calls to GetLatestConfiguration to check for and retrieve the latest data available.
When calling StartConfigurationSession
, your code sends the following
information:
-
Identifiers (ID or name) of an AWS AppConfig application, environment, and configuration profile that the session tracks.
-
(Optional) The minimum amount of time the session's client must wait between calls to
GetLatestConfiguration
.
In response, AWS AppConfig provides an InitialConfigurationToken
to be given to
the session's client and used the first time it calls GetLatestConfiguration
for that session.
Important
This token should only be used once in your first call to
GetLatestConfiguration
. You must use the new token in
the GetLatestConfiguration
response (NextPollConfigurationToken
)
in each subsequent call to GetLatestConfiguration
. To support long poll use
cases, the tokens are valid for up to 24 hours. If a GetLatestConfiguration
call uses an expired token, the system returns BadRequestException
.
When calling GetLatestConfiguration
, your client code sends the most recent
ConfigurationToken
value it has and receives in response:
-
NextPollConfigurationToken
: theConfigurationToken
value to use on the next call toGetLatestConfiguration
. -
NextPollIntervalInSeconds
: the duration the client should wait before making its next call toGetLatestConfiguration
. -
The configuration: the latest data intended for the session. This may be empty if the client already has the latest version of the configuration.
Important
Note the following important information.
-
The StartConfigurationSession API should only be called once per application, environment, configuration profile, and client to establish a session with the service. This is typically done in the startup of your application or immediately prior to the first retrieval of a configuration.
-
If your configuration is deployed using a
KmsKeyIdentifier
, your request to receive the configuration must include permission to callkms:Decrypt
. For more information, see Decrypt in the AWS Key Management Service API Reference. -
The API operation previously used to retrieve configuration data,
GetConfiguration
, is deprecated. TheGetConfiguration
API operation does not support encrypted configurations.