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
cacheEnabledoptionalbooleancache_enabledoptionalboolcacheEnabledoptionalBooleanCacheEnabledoptionalboolCacheEnabledoptional*bool= true#cacheSizeoptionalnumbercache_sizeoptionalint | floatcacheSizeoptionalNumberCacheSizeoptionaldoubleCacheSizeoptional*float64= 1000#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.
httpPortoptionalnumberhttp_portoptionalint | floathttpPortoptionalNumberHttpPortoptionaldoubleHttpPortoptional*float64= 2773#Valid port numbers are 1 - 65535.
logLeveloptionalParamsAndSecretsLogLevellog_leveloptionalParamsAndSecretsLogLevellogLeveloptionalParamsAndSecretsLogLevelLogLeveloptionalParamsAndSecretsLogLevelLogLeveloptionalParamsAndSecretsLogLevel#Default: Logging level will be info
Note: Set to debug to see the cache configuration.
maxConnectionsoptionalnumbermax_connectionsoptionalint | floatmaxConnectionsoptionalNumberMaxConnectionsoptionaldoubleMaxConnectionsoptional*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.
parameterStoreTimeoutoptionalDurationparameter_store_timeoutoptionalDurationparameterStoreTimeoutoptionalDurationParameterStoreTimeoutoptionalDurationParameterStoreTimeoutoptionalDuration= 0#A value of 0 means that there is no timeout.
parameterStoreTtloptionalDurationparameter_store_ttloptionalDurationparameterStoreTtloptionalDurationParameterStoreTtloptionalDurationParameterStoreTtloptionalDuration#Default: 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.
secretsManagerTimeoutoptionalDurationsecrets_manager_timeoutoptionalDurationsecretsManagerTimeoutoptionalDurationSecretsManagerTimeoutoptionalDurationSecretsManagerTimeoutoptionalDuration= 0#A value of 0 means that there is no timeout.
secretsManagerTtloptionalDurationsecrets_manager_ttloptionalDurationsecretsManagerTtloptionalDurationSecretsManagerTtloptionalDurationSecretsManagerTtloptionalDuration#Default: 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.