in packages/constructs/L3/datalake/datalake-l3-construct/lib/datalake-bucket-l3-construct.ts [566:714]
private getDataLakeFolderCrProvider(folderCrFunctionRole: MdaaLambdaRole): Provider {
if (this.dataLakeFolderProvider) {
return this.dataLakeFolderProvider;
}
const sourceDir = `${__dirname}/../src/python/datalake_folder`;
// This Lambda is used as a Custom Resource in order to create the Data Lake Folder
const datalakeFolderLambda = new MdaaLambdaFunction(this.scope, 'folder-cr-function', {
functionName: 'folder-cr',
code: Code.fromAsset(sourceDir),
handler: 'datalake_folder.lambda_handler',
runtime: Runtime.PYTHON_3_13,
timeout: Duration.seconds(120),
role: folderCrFunctionRole,
naming: this.props.naming,
createParams: false,
createOutputs: false,
environment: {
LOG_LEVEL: 'INFO',
},
});
MdaaNagSuppressions.addCodeResourceSuppressions(
datalakeFolderLambda,
[
{
id: 'NIST.800.53.R5-LambdaDLQ',
reason: 'Function is for custom resource and error handling will be handled by CloudFormation.',
},
{
id: 'NIST.800.53.R5-LambdaInsideVPC',
reason: 'Function is for custom resource and will interact only with S3.',
},
{
id: 'NIST.800.53.R5-LambdaConcurrency',
reason:
'Function is for custom resource and will only execute during stack deployement. Reserved concurrency not appropriate.',
},
{
id: 'HIPAA.Security-LambdaDLQ',
reason: 'Function is for custom resource and error handling will be handled by CloudFormation.',
},
{
id: 'PCI.DSS.321-LambdaDLQ',
reason: 'Function is for custom resource and error handling will be handled by CloudFormation.',
},
{
id: 'HIPAA.Security-LambdaInsideVPC',
reason: 'Function is for custom resource and will interact only with S3.',
},
{
id: 'PCI.DSS.321-LambdaInsideVPC',
reason: 'Function is for custom resource and will interact only with S3.',
},
{
id: 'HIPAA.Security-LambdaConcurrency',
reason:
'Function is for custom resource and will only execute during stack deployement. Reserved concurrency not appropriate.',
},
{
id: 'PCI.DSS.321-LambdaConcurrency',
reason:
'Function is for custom resource and will only execute during stack deployement. Reserved concurrency not appropriate.',
},
],
true,
);
const folderCrProviderFunctionName = this.props.naming.resourceName('folder-cr-prov', 64);
const folderCrProviderRole = new MdaaLambdaRole(this.scope, 'folder-provider-role', {
description: 'CR Role',
roleName: 'folder-provider-role',
naming: this.props.naming,
logGroupNames: [folderCrProviderFunctionName],
createParams: false,
createOutputs: false,
});
const datalakeFolderProvider = new Provider(this.scope, 'datalake-folder-cr-provider', {
providerFunctionName: folderCrProviderFunctionName,
onEventHandler: datalakeFolderLambda,
role: folderCrProviderRole,
});
MdaaNagSuppressions.addCodeResourceSuppressions(
folderCrProviderRole,
[
{
id: 'NIST.800.53.R5-IAMNoInlinePolicy',
reason: 'Role is for Custom Resource Provider. Inline policy automatically added.',
},
{
id: 'HIPAA.Security-IAMNoInlinePolicy',
reason: 'Role is for Custom Resource Provider. Inline policy automatically added.',
},
{
id: 'PCI.DSS.321-IAMNoInlinePolicy',
reason: 'Role is for Custom Resource Provider. Inline policy automatically added.',
},
],
true,
);
MdaaNagSuppressions.addCodeResourceSuppressions(
datalakeFolderProvider,
[
{ id: 'AwsSolutions-L1', reason: 'Lambda function Runtime set by CDK Provider Framework' },
{
id: 'NIST.800.53.R5-LambdaDLQ',
reason: 'Function is for custom resource and error handling will be handled by CloudFormation.',
},
{
id: 'NIST.800.53.R5-LambdaInsideVPC',
reason: 'Function is for custom resource and will interact only with S3.',
},
{
id: 'NIST.800.53.R5-LambdaConcurrency',
reason:
'Function is for custom resource and will only execute during stack deployement. Reserved concurrency not appropriate.',
},
{
id: 'HIPAA.Security-LambdaDLQ',
reason: 'Function is for custom resource and error handling will be handled by CloudFormation.',
},
{
id: 'PCI.DSS.321-LambdaDLQ',
reason: 'Function is for custom resource and error handling will be handled by CloudFormation.',
},
{
id: 'HIPAA.Security-LambdaInsideVPC',
reason: 'Function is for custom resource and will interact only with S3.',
},
{
id: 'PCI.DSS.321-LambdaInsideVPC',
reason: 'Function is for custom resource and will interact only with S3.',
},
{
id: 'HIPAA.Security-LambdaConcurrency',
reason:
'Function is for custom resource and will only execute during stack deployement. Reserved concurrency not appropriate.',
},
{
id: 'PCI.DSS.321-LambdaConcurrency',
reason:
'Function is for custom resource and will only execute during stack deployement. Reserved concurrency not appropriate.',
},
],
true,
);
this.dataLakeFolderProvider = datalakeFolderProvider;
return datalakeFolderProvider;
}