@cfn-modules/lambda-function
v2.10.0
Published
AWS Lambda function with automated IAM policy generation, encryption, log group and alerting
Downloads
161
Readme
cfn-modules: AWS Lambda function
AWS Lambda function with automated IAM policy generation, encryption, log group and alerting.
Install
Install Node.js and npm first!
npm i @cfn-modules/lambda-function
Usage
The lambda source code must be in the folder
lambda-src
.
If you pass in a module dependency (e.g.
DependencyModule1
), the environment variableDEPENDENCY1_ARN
inside the Lambda function will contain the ARN of the dependency.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules example'
Resources:
Function:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
AlertingModule: !GetAtt 'Alerting.Outputs.StackName' # optional
KmsKeyModule: !GetAtt 'Key.Outputs.StackName' # optional
VpcModule: !GetAtt 'Vpc.Outputs.StackName' # optional
DeadLetterQueueModule: !GetAtt 'Queue.Outputs.StackName' # optional
FunctionName: '' #optional
Description: '' # optional
Handler: 'example.handler' # required (file must be in the `lambda-src` folder)
MemorySize: '128' # optional
ReservedConcurrentExecutions: '-1' # optional
Runtime: 'nodejs14.x' # required
Timeout: '3' # optional
TracingConfigMode: PassThrough # optional
LogGroupRetentionInDays: '14' # optional
DependencyModule1: !GetAtt 'Queue.Outputs.StackName' # optional
DependencyModule2: !GetAtt 'Table.Outputs.StackName' # optional
DependencyModule3: '' # optional
EnvironmentVariable1: '' # optional
EnvironmentVariable2: '' # optional
EnvironmentVariable3: '' # optional
EnvironmentVariable4: '' # optional
EnvironmentVariable5: '' # optional
ManagedPolicyArns: '' # optional
LayerArns: '' # optional
ClientSgModule1: '' # optional
ClientSgModule2: '' # optional
ClientSgModule3: '' # optional
TemplateURL: './node_modules/@cfn-modules/lambda-function/module.yml'
Examples
Related modules
Event sources
Parameters
Migration Guides
Migrate to v2
- The
lambda-layer
module is no longer supported. Replace theLayerModule
parameter with a comma-delimited list of Layer ARNs to attach to the functionLayerArns
. Define the Lambda layer in your own template.