Right now in our CloudFormation templates we are creating few lambda functions, which then used multiple Cloudformation templates to do the automation task in order to have single click deployment of our product stack. Below is the sample CF template for CF lambda resources.
HelmLambda:
DependsOn: [ LambdaSGCleanup ]
Type: AWS::Lambda::Function
Properties:
Handler: lambda_function.lambda_handler
MemorySize: 512
Role: !Ref EKSProvisionRoleArn
Runtime: python3.7
Timeout: 900
Layers: [!Ref KubectlLayer, !Ref HelmLayer, !Ref CrhelperLayer]
Code:
S3Bucket: !Ref 'BucketName'
S3Key: !Sub '${KeyPrefix}functions/packages/Helm/lambda.zip'
HelmLayer:
Type: AWS::Lambda::LayerVersion
Properties:
Content:
S3Bucket: !Ref 'BucketName'
S3Key: !Sub '${KeyPrefix}functions/packages/helmLayer/lambda.zip'
In above lambda function we have two dependencies. One is IAM role and Layer ARN. IAM role and Layer ARN this create on run time.
Now we want to put our product on AWS-Marketplace and we came to know that creating lambda function as above is not supported by AWS-Marketplace guidelines.
We are thinking of converting our lambda functions to AWS SAM. but we are not able to figure out how to use IAM role and Layer Arn which are created at run time during the CF stack deployment with AWS SAM and create lambda functions.
Any help or guidance on this will be highly appreciated.