Lambda NET6: How to read connection string from Parameter Store?

0

Lambda NET 6 -> RDS PostgreSQL . During development I run it on my local workstation as a NET 6 Web app-> localhost PostgreSQL, After deploying to AWS I use RDS. The question: How can I read connection string from appsettings.json file in local version and from AWS Parameter store in case AWS?

Oleg
preguntada hace un año399 visualizaciones
1 Respuesta
2
Respuesta aceptada

Hi Oleg.

You can use the .NET Configuration Provider to easily read information from AWS Systems Manager Parameter Store. This extension is hosted on GitHub and is free and open source.

I hope this helps (if so, please accept the answer).

profile pictureAWS
EXPERTO
respondido hace un año
profile picture
EXPERTO
revisado hace 16 días
profile picture
EXPERTO
revisado hace 2 meses
  • Hi Jose, thank you for the interesting link. One question: how can I detect where code is executing to get config parameters from appsettings file when local machine and from Parameter store when in AWS?

  • Oleg,

    You would use environment variables for that. Note in the documentation the one called AWS_EXECUTION_ENV. It will return something prefixed with "AWS_Lambda" if it is running in Lambda.

    I hope this answers the question.

  • Also check LAMBDA_TASK_ROOT which will be null or empty for an environment other than Lambda.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas