UseCase:
I have a codecommit
repo that has 12 lambdas(6 nodejs
and 6 python
) and a cloud formation template. My goal is to build all the lambdas using codebuild and upload them as zip files to s3. After that, I have to pass the uploaded lambdas bucket keys to cloudformation template.
What I know ?
I know using SAM template you can use sam package or cloudformation package
command to build and upload them to s3. But I don't have SAM template instead I have cloudformation one.
What i tried ?
I wrote a bash script in buildspec.yml which will go into every lambda folder and build and copy the lambda to s3 bucket with the name lambdafolder.zip
where lambdafolder means lambda 1,2..12 . I am acheiving what I want but I am hard coding the S3Key
parameter for all the lambda functions in the cloudformation.
What i want ?
I want to know is there any elegant approach to this type of scenario just like SAM package
command.
Any help is appreciated. Thanks