1 year ago
#363938
Kacper Gwiazdowski
Creating db connection string with credentials stored in AWS secrets manager
I'm trying to use EF Core in ASP.NET Core with db credentials stored in AWS Secrets Manager.
I want to register dbContext like this:
services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer("connection_string"));
In order to do that I need data (username, password, host) from SecretsManager. The only problem is that all actions on AmazonSecretsManagerClient are async and ConfigureServices
in Startup is synchronous.
Building dependency injection tree should be kept simple, so this feels like downloading configuration and I think it should be performed before building dependency tree.
It feels like it should be a common problem, but I'm unable to find reliable solution. How should I approach this?
.net
amazon-web-services
asp.net-core
aws-secrets-manager
0 Answers
Your Answer