The Parameters utility provides high-level functionality to retrieve one or multiple parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager, or Amazon DynamoDB. Or bring your own providers.
- Retrieve one or multiple parameters from the underlying provider
- Cache parameter values for a given amount of time (defaults to 5 seconds)
- Transform parameter values from JSON or base 64 encoded strings
- Bring your own parameter store provider
For a full list of features go to docs.powertools.aws.dev/lambda/dotnet/utilities/parameters/
GitHub: https://github.com/aws-powertools/powertools-lambda-dotnet/
using AWS.Lambda.Powertools.Logging;
using AWS.Lambda.Powertools.Parameters;
using AWS.Lambda.Powertools.Parameters.SimpleSystemsManagement;
namespace HelloWorld;
public class Function
{
[Logging(LogEvent = true)]
public async Task<APIGatewayProxyResponse> FunctionHandler(APIGatewayProxyRequest apigwProxyEvent,
ILambdaContext context)
{
// Get SSM Provider instance
ISsmProvider ssmProvider = ParametersManager.SsmProvider;
// Retrieve a single parameter
string? value = await ssmProvider
.GetAsync("/my/parameter")
.ConfigureAwait(false);
// Retrieve multiple parameters from a path prefix
// This returns a Dictionary with the parameter name as key
IDictionary<string, string?> values = await ssmProvider
.GetMultipleAsync("/my/path/prefix")
.ConfigureAwait(false);
...
}
}