

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::Lambda::EventInvokeConfig
<a name="aws-resource-lambda-eventinvokeconfig"></a>

The `AWS::Lambda::EventInvokeConfig` resource configures options for [asynchronous invocation](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html) 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.

## Syntax
<a name="aws-resource-lambda-eventinvokeconfig-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-lambda-eventinvokeconfig-syntax.json"></a>

```
{
  "Type" : "AWS::Lambda::EventInvokeConfig",
  "Properties" : {
      "[DestinationConfig](#cfn-lambda-eventinvokeconfig-destinationconfig)" : DestinationConfig,
      "[FunctionName](#cfn-lambda-eventinvokeconfig-functionname)" : String,
      "[MaximumEventAgeInSeconds](#cfn-lambda-eventinvokeconfig-maximumeventageinseconds)" : Integer,
      "[MaximumRetryAttempts](#cfn-lambda-eventinvokeconfig-maximumretryattempts)" : Integer,
      "[Qualifier](#cfn-lambda-eventinvokeconfig-qualifier)" : String
    }
}
```

### YAML
<a name="aws-resource-lambda-eventinvokeconfig-syntax.yaml"></a>

```
Type: AWS::Lambda::EventInvokeConfig
Properties:
  [DestinationConfig](#cfn-lambda-eventinvokeconfig-destinationconfig): 
    DestinationConfig
  [FunctionName](#cfn-lambda-eventinvokeconfig-functionname): String
  [MaximumEventAgeInSeconds](#cfn-lambda-eventinvokeconfig-maximumeventageinseconds): Integer
  [MaximumRetryAttempts](#cfn-lambda-eventinvokeconfig-maximumretryattempts): Integer
  [Qualifier](#cfn-lambda-eventinvokeconfig-qualifier): String
```

## Properties
<a name="aws-resource-lambda-eventinvokeconfig-properties"></a>

`DestinationConfig`  <a name="cfn-lambda-eventinvokeconfig-destinationconfig"></a>
A destination for events after they have been sent to a function for processing.  

**Destinations**
+ **Function** - The Amazon Resource Name (ARN) of a Lambda function.
+ **Queue** - The ARN of a standard SQS queue.
+ **Bucket** - The ARN of an Amazon S3 bucket.
+ **Topic** - The ARN of a standard SNS topic.
+ **Event Bus** - The ARN of an Amazon EventBridge event bus.
S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.
*Required*: No  
*Type*: [DestinationConfig](aws-properties-lambda-eventinvokeconfig-destinationconfig.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`FunctionName`  <a name="cfn-lambda-eventinvokeconfig-functionname"></a>
The name of the Lambda function.  
*Minimum*: `1`  
*Maximum*: `64`  
*Pattern*: `([a-zA-Z0-9-_]+)`  
*Required*: Yes  
*Type*: String  
*Pattern*: `^(arn:(aws[a-zA-Z-]*)?:lambda:)?([a-z]+(-[a-z]+)+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\$LATEST(\.PUBLISHED)?|[a-zA-Z0-9-_]+))?$`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`MaximumEventAgeInSeconds`  <a name="cfn-lambda-eventinvokeconfig-maximumeventageinseconds"></a>
The maximum age of a request that Lambda sends to a function for processing.  
*Required*: No  
*Type*: Integer  
*Minimum*: `60`  
*Maximum*: `21600`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MaximumRetryAttempts`  <a name="cfn-lambda-eventinvokeconfig-maximumretryattempts"></a>
The maximum number of times to retry when the function returns an error.  
*Required*: No  
*Type*: Integer  
*Minimum*: `0`  
*Maximum*: `2`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Qualifier`  <a name="cfn-lambda-eventinvokeconfig-qualifier"></a>
The identifier of a version or alias.  
+ **Version** - A version number.
+ **Alias** - An alias name.
+ **Latest** - To specify the unpublished version, use `$LATEST`.
*Required*: Yes  
*Type*: String  
*Pattern*: `^\$(LATEST(\.PUBLISHED)?)|[a-zA-Z0-9$_-]{1,129}$`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-lambda-eventinvokeconfig-return-values"></a>

### Ref
<a name="aws-resource-lambda-eventinvokeconfig-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns a unique identifier for this resource.

## Examples
<a name="aws-resource-lambda-eventinvokeconfig--examples"></a>



### Asynchronous Invocation Configuration
<a name="aws-resource-lambda-eventinvokeconfig--examples--Asynchronous_Invocation_Configuration"></a>

Error handling and destination configuration for a version of a function. Node.js function and version are included.

#### YAML
<a name="aws-resource-lambda-eventinvokeconfig--examples--Asynchronous_Invocation_Configuration--yaml"></a>

```
Resources:
  function:
    Type: AWS::Lambda::Function
    Properties:
      Handler: index.handler
      Role: arn:aws:iam::123456789012:role/lambda-role
      Code:
        ZipFile: |
          exports.handler = async (event) => {
              console.log(JSON.stringify(event, null, 2));
              const response = {
                  statusCode: 200,
                  body: JSON.stringify('Hello from Lambda!'),
              };
              return response;
          };
      Runtime: nodejs18.x
      TracingConfig:
        Mode: Active
  version:
    Type: AWS::Lambda::Version
    Properties:
      FunctionName: !Ref function
  asyncconfig:
    Type: AWS::Lambda::EventInvokeConfig
    Properties:
      DestinationConfig:
          OnFailure:
            Destination: arn:aws:sqs:us-east-2:123456789012:dlq
          OnSuccess:
            Destination: arn:aws:sqs:us-east-2:123456789012:dlq
      FunctionName: !Ref function
      MaximumEventAgeInSeconds: 300
      MaximumRetryAttempts: 1
      Qualifier: !GetAtt version.Version
```

# AWS::Lambda::EventInvokeConfig DestinationConfig
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig"></a>

A configuration object that specifies the destination of an event after Lambda processes it. For more information, see [Adding a destination](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html#invocation-async-destinations).

## Syntax
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig-syntax.json"></a>

```
{
  "[OnFailure](#cfn-lambda-eventinvokeconfig-destinationconfig-onfailure)" : OnFailure,
  "[OnSuccess](#cfn-lambda-eventinvokeconfig-destinationconfig-onsuccess)" : OnSuccess
}
```

### YAML
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig-syntax.yaml"></a>

```
  [OnFailure](#cfn-lambda-eventinvokeconfig-destinationconfig-onfailure): 
    OnFailure
  [OnSuccess](#cfn-lambda-eventinvokeconfig-destinationconfig-onsuccess): 
    OnSuccess
```

## Properties
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig-properties"></a>

`OnFailure`  <a name="cfn-lambda-eventinvokeconfig-destinationconfig-onfailure"></a>
The destination configuration for failed invocations.  
When using an Amazon SQS queue as a destination, FIFO queues cannot be used.
*Required*: No  
*Type*: [OnFailure](aws-properties-lambda-eventinvokeconfig-onfailure.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`OnSuccess`  <a name="cfn-lambda-eventinvokeconfig-destinationconfig-onsuccess"></a>
The destination configuration for successful invocations.  
When using an Amazon SQS queue as a destination, FIFO queues cannot be used.
*Required*: No  
*Type*: [OnSuccess](aws-properties-lambda-eventinvokeconfig-onsuccess.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Examples
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig--examples"></a>



### On-Failure Destination Configuration
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig--examples--On-Failure_Destination_Configuration"></a>

Configure a function to send a record of failed asynchronous invocations to an SQS queue.

#### YAML
<a name="aws-properties-lambda-eventinvokeconfig-destinationconfig--examples--On-Failure_Destination_Configuration--yaml"></a>

```
      DestinationConfig:
          OnFailure:
            Destination: arn:aws:sqs:us-east-2:123456789012:dlq
```

# AWS::Lambda::EventInvokeConfig OnFailure
<a name="aws-properties-lambda-eventinvokeconfig-onfailure"></a>

A destination for events that failed processing. For more information, see [Adding a destination](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html#invocation-async-destinations).

## Syntax
<a name="aws-properties-lambda-eventinvokeconfig-onfailure-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-lambda-eventinvokeconfig-onfailure-syntax.json"></a>

```
{
  "[Destination](#cfn-lambda-eventinvokeconfig-onfailure-destination)" : String
}
```

### YAML
<a name="aws-properties-lambda-eventinvokeconfig-onfailure-syntax.yaml"></a>

```
  [Destination](#cfn-lambda-eventinvokeconfig-onfailure-destination): String
```

## Properties
<a name="aws-properties-lambda-eventinvokeconfig-onfailure-properties"></a>

`Destination`  <a name="cfn-lambda-eventinvokeconfig-onfailure-destination"></a>
The Amazon Resource Name (ARN) of the destination resource.  
To retain records of failed invocations from [Kinesis](https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html), [DynamoDB](https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html), [self-managed Apache Kafka](https://docs.aws.amazon.com/lambda/latest/dg/kafka-on-failure.html), or [Amazon MSK](https://docs.aws.amazon.com/lambda/latest/dg/kafka-on-failure.html), you can configure an Amazon SNS topic, Amazon SQS queue, Amazon S3 bucket, or Kafka topic as the destination.  
Amazon SNS destinations have a message size limit of 256 KB. If the combined size of the function request and response payload exceeds the limit, Lambda will drop the payload when sending `OnFailure` event to the destination. For details on this behavior, refer to [Retaining records of asynchronous invocations](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html).
To retain records of failed invocations from [Kinesis](https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html), [DynamoDB](https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html), [self-managed Kafka](https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-smaa-onfailure-destination) or [Amazon MSK](https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-onfailure-destination), you can configure an Amazon SNS topic, Amazon SQS queue, or Amazon S3 bucket as the destination.  
*Required*: Yes  
*Type*: String  
*Pattern*: `^$|arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]+(-[a-z]+)+-\d{1})?:(\d{12})?:(.*)`  
*Minimum*: `0`  
*Maximum*: `350`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Examples
<a name="aws-properties-lambda-eventinvokeconfig-onfailure--examples"></a>



### On-Failure Destination Configuration
<a name="aws-properties-lambda-eventinvokeconfig-onfailure--examples--On-Failure_Destination_Configuration"></a>

Configure a function to send a record of failed asynchronous invocations to an SQS queue.

#### YAML
<a name="aws-properties-lambda-eventinvokeconfig-onfailure--examples--On-Failure_Destination_Configuration--yaml"></a>

```
          OnFailure:
            Destination: arn:aws:sqs:us-east-2:123456789012:dlq
```

# AWS::Lambda::EventInvokeConfig OnSuccess
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess"></a>

A destination for events that were processed successfully.

To retain records of successful [asynchronous invocations](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations), you can configure an Amazon SNS topic, Amazon SQS queue, Lambda function, or Amazon EventBridge event bus as the destination.

**Note**  
`OnSuccess` is not supported in `CreateEventSourceMapping` or `UpdateEventSourceMapping` requests.

## Syntax
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess-syntax.json"></a>

```
{
  "[Destination](#cfn-lambda-eventinvokeconfig-onsuccess-destination)" : String
}
```

### YAML
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess-syntax.yaml"></a>

```
  [Destination](#cfn-lambda-eventinvokeconfig-onsuccess-destination): String
```

## Properties
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess-properties"></a>

`Destination`  <a name="cfn-lambda-eventinvokeconfig-onsuccess-destination"></a>
The Amazon Resource Name (ARN) of the destination resource.  
Amazon SNS destinations have a message size limit of 256 KB. If the combined size of the function request and response payload exceeds the limit, Lambda will drop the payload when sending `OnFailure` event to the destination. For details on this behavior, refer to [Retaining records of asynchronous invocations](https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html).
*Required*: Yes  
*Type*: String  
*Pattern*: `^$|arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]+(-[a-z]+)+-\d{1})?:(\d{12})?:(.*)`  
*Minimum*: `0`  
*Maximum*: `350`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Examples
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess--examples"></a>



### On-Success Destination Configuration
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess--examples--On-Success_Destination_Configuration"></a>

Configure a function to send a record of successful asynchronous invocations to an SQS queue.

#### YAML
<a name="aws-properties-lambda-eventinvokeconfig-onsuccess--examples--On-Success_Destination_Configuration--yaml"></a>

```
          OnSuccess:
            Destination: arn:aws:sqs:us-east-2:123456789012:destination
```