AWS Lambda Function Event Invoke Config
This page shows how to write Terraform and CloudFormation for Lambda Function Event Invoke Config and write them securely.
aws_lambda_function_event_invoke_config (Terraform)
The Function Event Invoke Config in Lambda can be configured in Terraform with the resource name aws_lambda_function_event_invoke_config
. The following sections describe 1 example of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_lambda_function_event_invoke_config" "secretsmanager_eks_sync" {
function_name = aws_lambda_function.secretsmanager_eks_sync.function_name
maximum_retry_attempts = 0
}
Parameters
-
function_name
required - string -
id
optional computed - string -
maximum_event_age_in_seconds
optional - number -
maximum_retry_attempts
optional - number -
qualifier
optional - string -
destination_config
list block-
on_failure
list block-
destination
required - string
-
-
on_success
list block-
destination
required - string
-
-
Explanation in Terraform Registry
Manages an asynchronous invocation configuration for a Lambda Function or Alias. More information about asynchronous invocations and the configurable values can be found in the Lambda Developer Guide.
Tips: Best Practices for The Other AWS Lambda Resources
In addition to the aws_lambda_permission, AWS Lambda has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
aws_lambda_permission
Ensure to limit your Lambda function permission as much as possible
It is better for limiting the Lambda function permission to set `source_arn` if the ARN can be specified to grant permissions.
AWS::Lambda::EventInvokeConfig (CloudFormation)
The EventInvokeConfig in Lambda can be configured in CloudFormation with the resource name AWS::Lambda::EventInvokeConfig
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: "AWS::Lambda::EventInvokeConfig"
Properties:
FunctionName: !Ref ExtractLambdaFunction
DestinationConfig:
OnSuccess:
Destination: !GetAtt Group3SQSExtracttoTransform.Arn
Type: "AWS::Lambda::EventInvokeConfig"
Properties:
FunctionName: !Ref ExtractLambdaFunction
DestinationConfig:
OnSuccess:
Destination: !GetAtt Group1SQSExtracttoTransform.Arn
Type: "AWS::Lambda::EventInvokeConfig"
Properties:
FunctionName: !Ref ExtractLambdaFunction
DestinationConfig:
OnSuccess:
Destination: !GetAtt Group3SQSExtracttoTransform.Arn
Type: "AWS::Lambda::EventInvokeConfig"
Properties:
FunctionName: !Ref ExtractLambdaFunction
DestinationConfig:
OnSuccess:
Destination: !GetAtt Group3SQSExtracttoTransform.Arn
Type: AWS::Lambda::EventInvokeConfig
Properties:
FunctionName:
Ref: DbupdateLambdaFunction
MaximumRetryAttempts: 0
Qualifier: $LATEST
"Type": "AWS::Lambda::EventInvokeConfig",
"Properties": {
"FunctionName": {
"Ref": "SnsSqsC4810B27"
},
"Qualifier": "$LATEST",
"Type": "AWS::Lambda::EventInvokeConfig",
"Properties": {
"FunctionName": {
"Ref": "SnsSqsC4810B27"
},
"Qualifier": "$LATEST",
"Type": "AWS::Lambda::EventInvokeConfig",
"Properties": {
"FunctionName": {
"Ref": "SnsSqsC4810B27"
},
"Qualifier": "$LATEST",
"Type": "AWS::Lambda::EventInvokeConfig",
"Properties": {
"FunctionName": {
"Ref": "SnsSqsC4810B27"
},
"Qualifier": "$LATEST",
{ "LogicalResourceId":"MyTestFunction2EventInvokeConfig", "ResourceType":"AWS::Lambda::EventInvokeConfig"},
{ "LogicalResourceId":"MyTestFunction2Version", "ResourceType":"AWS::Lambda::Version"},
{ "LogicalResourceId":"MyTestFunctionEventInvokeConfig", "ResourceType":"AWS::Lambda::EventInvokeConfig"},
{ "LogicalResourceId":"DestinationLambdaRole", "ResourceType":"AWS::IAM::Role"}
Parameters
-
FunctionName
required - String -
MaximumRetryAttempts
optional - Integer -
DestinationConfig
optional - DestinationConfig -
Qualifier
required - String -
MaximumEventAgeInSeconds
optional - Integer
Explanation in CloudFormation Registry
The
AWS::Lambda::EventInvokeConfig
resource configures options for asynchronous invocation on a version or an alias.By default, Lambda retries an asynchronous invocation twice if the function returns an error. It retains events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous invocation queue for too long, Lambda discards it.
Frequently asked questions
What is AWS Lambda Function Event Invoke Config?
AWS Lambda Function Event Invoke Config is a resource for Lambda of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Lambda Function Event Invoke Config?
For Terraform, the IronCore864/terraform-sm2kubes source code example is useful. See the Terraform Example section for further details.
For CloudFormation, the jacobcallear/infinityque, dnpaul97/cafe_connect and shameelabegum/infinity-que source code examples are useful. See the CloudFormation Example section for further details.