AWS Systems Manager Parameter Store configuration provider implementation for Microsoft.Extensions.Configuration.
You should install AwsParameterStore.Microsoft.Extensions.Configuration with NuGet:
Install-Package AwsParameterStore.Microsoft.Extensions.Configuration
Or via the .NET Core command line interface:
dotnet add package AwsParameterStore.Microsoft.Extensions.Configuration
The provider is added to the ConfigurationBuilder
using the AddAwsParameterStore
extension. The default method accepts one parameter path
which is the prefix of the parameter store hierarchy.
configrationBuilder.AddAwsParameterStore("/prefix");
Parameter Store supports parameter hierarchy. The Hierarchical values use "/" as a separator such as "/DeploymentConfig/Prod/FleetHealth". ASP.NET Core configuration normally uses colon as separator so before adding the values to the configuration we swap the forward slash "/" with colon.
By default, AWS Access Key ID and AWS Secret Access Key are discovered from environment variables AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
respectively.
An AWS IAM account with ssm:GetParametersByPath
permission.
Secrets are cached until IConfigurationRoot.Reload() is called. Expired, disabled, and updated secrets in the key vault are not respected by the application until Reload is executed.
Configuration.Reload();