Search code examples
amazon-web-servicesaws-parameter-store

AWS Lambda (NET6): how to store parameter the same way as in appsettings.json?


I have a AWS Lambda NET6 and it uses appsettings.json. Now I want to use AWS Parameter Store instead of appsettings.json to keep db connection string and other params.

How should I store parameter as I have in my appsettings.json : "Cognito": { "Authority": "https://cognito-idp.eu-west-2.amazonaws.com/eu-west-2_x51234567" } ?
My app does not process it, it is read by authorization extensions. The question is: how it should be in AWS PS?


Solution

  • I would store it by parameter store (AWS PS) key like this to just retrieve it with Singleton/Utility parameter store reader class for config:
    "Cognito": { "Authority": "<PARAMETER-STORE-KEY>" }

    OR

    you can just store the whole JSON string in the AWS PS and convert it again during the config setup, but not ideal for large strings.

    OR

    Using Amazon.Extensions.Configuration.SystemsManager