Class ParamsAndSecretsOptions
Parameters and Secrets Extension configuration options.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ParamsAndSecretsOptions : Object, IParamsAndSecretsOptions
Syntax (vb)
Public Class ParamsAndSecretsOptions
Inherits Object
Implements IParamsAndSecretsOptions
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.SecretsManager;
using Amazon.CDK.AWS.SSM;
var secret = new Secret(this, "Secret");
var parameter = new StringParameter(this, "Parameter", new StringParameterProps {
ParameterName = "mySsmParameterName",
StringValue = "mySsmParameterValue"
});
var paramsAndSecrets = ParamsAndSecretsLayerVersion.FromVersion(ParamsAndSecretsVersions.V1_0_103, new ParamsAndSecretsOptions {
CacheSize = 500,
LogLevel = ParamsAndSecretsLogLevel.DEBUG
});
var lambdaFunction = new Function(this, "MyFunction", new FunctionProps {
Runtime = Runtime.NODEJS_18_X,
Handler = "index.handler",
Architecture = Architecture.ARM_64,
Code = Code.FromAsset(Join(__dirname, "lambda-handler")),
ParamsAndSecrets = paramsAndSecrets
});
secret.GrantRead(lambdaFunction);
parameter.GrantRead(lambdaFunction);
Synopsis
Constructors
ParamsAndSecretsOptions() |
Properties
CacheEnabled | Whether the Parameters and Secrets Extension will cache parameters and secrets. |
CacheSize | The maximum number of secrets and parameters to cache. |
HttpPort | The port for the local HTTP server. |
LogLevel | The level of logging provided by the Parameters and Secrets Extension. |
MaxConnections | The maximum number of connection for HTTP clients that the Parameters and Secrets Extension uses to make requests to Parameter Store or Secrets Manager. |
ParameterStoreTimeout | The timeout for requests to Parameter Store. |
ParameterStoreTtl | The time-to-live of a parameter in the cache. |
SecretsManagerTimeout | The timeout for requests to Secrets Manager. |
SecretsManagerTtl | The time-to-live of a secret in the cache. |
Constructors
ParamsAndSecretsOptions()
public ParamsAndSecretsOptions()
Properties
CacheEnabled
Whether the Parameters and Secrets Extension will cache parameters and secrets.
public Nullable<bool> CacheEnabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
CacheSize
The maximum number of secrets and parameters to cache.
public Nullable<double> CacheSize { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Must be a value from 0 to 1000. A value of 0 means there is no caching.
Note: This variable is ignored if parameterStoreTtl and secretsManagerTtl are 0.
Default: 1000
HttpPort
The port for the local HTTP server.
public Nullable<double> HttpPort { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Valid port numbers are 1 - 65535.
Default: 2773
LogLevel
The level of logging provided by the Parameters and Secrets Extension.
public Nullable<ParamsAndSecretsLogLevel> LogLevel { get; set; }
Property Value
System.Nullable<ParamsAndSecretsLogLevel>
Remarks
Note: Set to debug to see the cache configuration.
Default: - Logging level will be info
MaxConnections
The maximum number of connection for HTTP clients that the Parameters and Secrets Extension uses to make requests to Parameter Store or Secrets Manager.
public Nullable<double> MaxConnections { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
There is no maximum limit. Minimum is 1.
Note: Every running copy of this Lambda function may open the number of connections specified by this property. Thus, the total number of connections may exceed this number.
Default: 3
ParameterStoreTimeout
The timeout for requests to Parameter Store.
public Duration ParameterStoreTimeout { get; set; }
Property Value
Remarks
A value of 0 means that there is no timeout.
Default: 0
ParameterStoreTtl
The time-to-live of a parameter in the cache.
public Duration ParameterStoreTtl { get; set; }
Property Value
Remarks
A value of 0 means there is no caching. The maximum time-to-live is 300 seconds.
Note: This variable is ignored if cacheSize is 0.
Default: 300 seconds
SecretsManagerTimeout
The timeout for requests to Secrets Manager.
public Duration SecretsManagerTimeout { get; set; }
Property Value
Remarks
A value of 0 means that there is no timeout.
Default: 0
SecretsManagerTtl
The time-to-live of a secret in the cache.
public Duration SecretsManagerTtl { get; set; }
Property Value
Remarks
A value of 0 means there is no caching. The maximum time-to-live is 300 seconds.
Note: This variable is ignored if cacheSize is 0.
Default: 300 seconds