skip to Main Content

I want to access config files from AWS AppConfig in .Net Core (AWS Lambda). How can I do that? I have seen in the AWS docs that the recommended way is to use the GetLatestConfiguration and StartConfigurationSession APIs but I am unable to find the functions in AWS .Net Client SDK.

2

Answers


  1. One of the easiest ways to do this is using the App Config Lambda extension. The link below provides further detail, but the extension simplifies a lot of the communication between your function and AppConfig whilst also providing an element of caching and cost reduction.

    From your perspective, you then interact with AppConfig by making requests to a local web endpoint
    (http://localhost:2772/applications/application_name/environments/environment_name/configurations/configuration_name)

    Full details can be found below.

    https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-integration-lambda-extensions.html

    Login or Signup to reply.
  2. I was able to get this working by using AWSSDK.AppConfigData nuget package.

    Note that examples out on the web you may find make it difficult to find it due to the namespace changing from the deprecated version.

    I want to emphasize again that the sdk is AWSSDK.AppConfigData and not the deprecated AWSSDK.AppConfig.

    Once the package is installed you can leverage the sdk with:

    using Amazon.AppConfigData;
    using Amazon.AppConfigData.Model

    Client model is called AmazonAppConfigDataClient
    once you initialize the client you can call StartConfigurationSessionAsync which accepts a model of StartConfigurationSessionRequest and will return a StartConfigurationSessionResponse

    You can then use the client to call GetLatestConfigurationAsync

    GetLatestConfigurationAsync will accept a model of GetLatestConfigurationRequest. You can populate its InitialConfigurationToken property with from the StartConfigurationSessionResponse.InitialConfigurationToken you get back from your session call.

    Happy coding!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search