1- import * as lambda from '@ aws-cdk/aws-lambda' ;
2- import { CfnLayerVersion , Code , Runtime } from '@ aws-cdk/aws-lambda' ;
1+ import * as lambda from 'aws-cdk-lib /aws-lambda' ;
2+ import { CfnLayerVersion , Code , Runtime } from 'aws-cdk-lib /aws-lambda' ;
33import * as path from 'path' ;
4- import { App , BundlingDockerImage , Duration , Stack } from '@ aws-cdk/core ' ;
4+ import { App , DockerImage , Duration , Stack } from 'aws-cdk-lib ' ;
55
66
77const app = new App ( ) ;
@@ -13,18 +13,19 @@ const pathToLayerSource = path.resolve(__dirname, '..');
1313const al2Layer = new lambda . LayerVersion ( stack , 'al2-layer' , {
1414 code : Code . fromAsset ( pathToLayerSource , {
1515 bundling : {
16- image : BundlingDockerImage . fromAsset ( pathToLayerSource , { file : '../ Dockerfile.al2' } ) ,
16+ image : DockerImage . fromBuild ( pathToLayerSource , { file : 'Dockerfile.al2' } ) ,
1717 command : [ '/bin/bash' , '-c' , 'cp -r /opt/build-dist/. /asset-output/' ] ,
1818 } ,
1919 } ) ,
2020 description : 'AL2 Tesseract Layer' ,
2121} ) ;
2222stack . renameLogicalId ( stack . getLogicalId ( al2Layer . node . defaultChild as CfnLayerVersion ) , 'al2layer' )
23+
2324new lambda . Function ( stack , 'python3.8' , {
24- code : lambda . Code . fromAsset ( path . resolve ( __dirname , 'lambda-handlers' ) ,
25+ code : lambda . Code . fromAsset ( path . resolve ( __dirname , 'lambda-handlers/py38 ' ) ,
2526 {
2627 bundling : {
27- image : BundlingDockerImage . fromRegistry ( 'lambci/lambda:build-python3.8' ) ,
28+ image : DockerImage . fromRegistry ( 'lambci/lambda:build-python3.8' ) ,
2829 command : [ '/bin/bash' , '-c' , [
2930 'pip install -r requirements.txt -t /asset-output/' ,
3031 'cp faust.png /asset-output' ,
0 commit comments