ParamsAndSecretsOptions Struct
Parameters and Secrets Extension configuration options.
Example
import * as sm from 'aws-cdk-lib/aws-secretsmanager';
import * as ssm from 'aws-cdk-lib/aws-ssm';
const secret = new sm.Secret(this, 'Secret');
const parameter = new ssm.StringParameter(this, 'Parameter', {
parameterName: 'mySsmParameterName',
stringValue: 'mySsmParameterValue',
});
const paramsAndSecrets = lambda.ParamsAndSecretsLayerVersion.fromVersion(lambda.ParamsAndSecretsVersions.V1_0_103, {
cacheSize: 500,
logLevel: lambda.ParamsAndSecretsLogLevel.DEBUG,
});
const lambdaFunction = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_LATEST,
handler: 'index.handler',
architecture: lambda.Architecture.ARM_64,
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
paramsAndSecrets,
});
secret.grantRead(lambdaFunction);
parameter.grantRead(lambdaFunction);
Properties
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.
Valid port numbers are 1 - 65535.
logLevelParamsAndSecretsLogLevellog_levelParamsAndSecretsLogLevellogLevelParamsAndSecretsLogLevelLogLevelParamsAndSecretsLogLevelLogLevelParamsAndSecretsLogLevel= Logging level will be `info`#Note: Set to debug to see the cache configuration.
maxConnectionsnumbermax_connectionsint | floatmaxConnectionsNumberMaxConnectionsdoubleMaxConnections*float64= 3#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.
parameterStoreTimeoutDurationparameter_store_timeoutDurationparameterStoreTimeoutDurationParameterStoreTimeoutDurationParameterStoreTimeoutDuration= 0#A value of 0 means that there is no timeout.
parameterStoreTtlDurationparameter_store_ttlDurationparameterStoreTtlDurationParameterStoreTtlDurationParameterStoreTtlDuration= 300 seconds#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.
secretsManagerTimeoutDurationsecrets_manager_timeoutDurationsecretsManagerTimeoutDurationSecretsManagerTimeoutDurationSecretsManagerTimeoutDuration= 0#A value of 0 means that there is no timeout.
secretsManagerTtlDurationsecrets_manager_ttlDurationsecretsManagerTtlDurationSecretsManagerTtlDurationSecretsManagerTtlDuration= 300 seconds#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.