I Tried Receiving AWS Lambda Function State Change Events with an EventBridge Rule

I Tried Receiving AWS Lambda Function State Change Events with an EventBridge Rule

Lambda function deployments and state changes can now be captured as EventBridge events without polling the GetFunction API. I checked the event types and contents delivered on create, update, publish and delete, and tried rules filtering by function ARN and state.
2026.11.22

This page has been translated by machine translation. View original

Introduction

On November 20, 2026, Amazon EventBridge support for AWS Lambda function state change events was announced.

https://aws.amazon.com/about-aws/whats-new/2026/11/aws-lambda-function-state-events/

With this update, an event is now sent to EventBridge every time the state of a version changes through creating, updating, publishing, or deleting a Lambda function.

This article introduces the types and contents of the events that arrive, and the results of trying out filtering with rules.

Test Environment

  • Region: Tokyo (ap-northeast-1)
  • AWS CLI: 2.42.1
  • Runtime: Python 3.13
  • Event bus: default

Receiving All Events

Using a rule whose condition is only source, I collected all aws.lambda events into an SQS queue and checked which events arrive for each function operation. There were two rules, one for all events and one for filtering, and I created both first before operating on the function.

Creating the Queue and Rule

Create an SQS queue and set a queue policy that allows sending from EventBridge.

aws sqs create-queue --queue-name fse-verify-all --region ap-northeast-1
aws sqs set-queue-attributes --queue-url https://sqs.ap-northeast-1.amazonaws.com/111122223333/fse-verify-all --attributes file://artifacts/queue-attrs-fse-verify-all.json --region ap-northeast-1
queue-attrs-fse-verify-all.json
{
  "Policy": "{\"Version\": \"2012-10-17\", \"Statement\": [{\"Effect\": \"Allow\", \"Principal\": {\"Service\": \"events.amazonaws.com\"}, \"Action\": \"sqs:SendMessage\", \"Resource\": \"arn:aws:sqs:ap-northeast-1:111122223333:fse-verify-all\", \"Condition\": {\"ArnEquals\": {\"aws:SourceArn\": \"arn:aws:events:ap-northeast-1:111122223333:rule/fse-verify-all\"}}}]}"
}

The event pattern file pattern-all.json is the following single line.

{"source": ["aws.lambda"]}

Create a rule with this file and set the queue as the target.

aws events put-rule --name fse-verify-all --event-pattern file://artifacts/pattern-all.json --region ap-northeast-1
aws events put-targets --rule fse-verify-all --targets 'Id=1,Arn=arn:aws:sqs:ap-northeast-1:111122223333:fse-verify-all' --region ap-northeast-1

Events by Operation

On the Lambda function fse-verify-target, I ran creation, code update, configuration update (changing memory to 256 MB), version publishing, and deletion in order. For comparison, I also created and deleted another function, fse-verify-other.

From the events retrieved with receive-message, excluding those whose detail-type is AWS API Call via CloudTrail, there were 11.

The following table lists these 11 events in time order. The leading Event Function Version of detail-type is omitted.

time detail-type action state lastUpdateStatus resources (function name:version)
15:21:48Z Activating CreateFunction Pending - fse-verify-target:$LATEST
15:21:51Z Activated CreateFunction Active Successful fse-verify-target:$LATEST
15:22:01Z Updating UpdateFunctionCode Active InProgress fse-verify-target:$LATEST
15:22:02Z Updated UpdateFunctionCode Active Successful fse-verify-target:$LATEST
15:22:11Z Updating UpdateFunctionConfiguration Active InProgress fse-verify-target:$LATEST
15:22:12Z Updated UpdateFunctionConfiguration Active Successful fse-verify-target:$LATEST
15:22:22Z Activated PublishVersion Active Successful fse-verify-target:1
15:22:31Z Activating CreateFunction Pending - fse-verify-other:$LATEST
15:22:34Z Activated CreateFunction Active Successful fse-verify-other:$LATEST
15:22:44Z Deleted DeleteFunction - - fse-verify-other
15:22:44Z Deleted DeleteFunction - - fse-verify-target

Fields in detail

Here is the Updating event for the code update, with indentation adjusted.

{
  "version": "0",
  "id": "85ce89e9-0a1e-8612-59a9-f97414851cf0",
  "detail-type": "Event Function Version Updating",
  "source": "aws.lambda",
  "account": "111122223333",
  "time": "2026-11-21T15:22:01Z",
  "region": "ap-northeast-1",
  "resources": [
    "arn:aws:lambda:ap-northeast-1:111122223333:function:fse-verify-target:$LATEST"
  ],
  "detail": {
    "revisionId": "049ac8a1-2ed5-4bfe-add0-6be3d4f577ab",
    "lastUpdateStatus": "InProgress",
    "lastUpdateStatusReasonCode": "Creating",
    "action": "UpdateFunctionCode",
    "state": "Active"
  }
}

Since state remains Active during an update, you distinguish between in progress and completed by lastUpdateStatus (InProgress and Successful).

The fields in detail for the events that arrived in this test were as follows for each detail-type.

detail-type Fields in detail
Activating action, revisionId, state, stateReason, stateReasonCode
Activated action, lastUpdateStatus, revisionId, state
Updating action, lastUpdateStatus, lastUpdateStatusReasonCode, revisionId, state
Updated action, lastUpdateStatus, revisionId, state
Deleted action, revisionId

Filtering Events

Using a rule whose conditions are a function ARN prefix and state, I sent the events of fse-verify-target to SQS.

Event Pattern

Create the filtering queue fse-verify-filtered with the same steps as for the all-events queue. What changes are the queue name, the queue name in the Resource of the queue policy, and the rule name in aws:SourceArn. The pattern file pattern-filtered.json has the following content.

{
  "source": [
    "aws.lambda"
  ],
  "resources": [
    {
      "prefix": "arn:aws:lambda:ap-northeast-1:111122223333:function:fse-verify-target"
    }
  ],
  "detail": {
    "state": [
      "Active"
    ]
  }
}
aws events put-rule --name fse-verify-filtered --event-pattern file://artifacts/pattern-filtered.json --region ap-northeast-1
aws events put-targets --rule fse-verify-filtered --targets 'Id=1,Arn=arn:aws:sqs:ap-northeast-1:111122223333:fse-verify-filtered' --region ap-northeast-1

Filtering Results

With the function operations described above, 5 events arrived in the filtering queue. The following table lists these 5 events in time order.

time detail-type action state lastUpdateStatus resources (function name:version)
15:22:01Z Updating UpdateFunctionCode Active InProgress fse-verify-target:$LATEST
15:22:02Z Updated UpdateFunctionCode Active Successful fse-verify-target:$LATEST
15:22:11Z Updating UpdateFunctionConfiguration Active InProgress fse-verify-target:$LATEST
15:22:12Z Updated UpdateFunctionConfiguration Active Successful fse-verify-target:$LATEST
15:22:22Z Activated PublishVersion Active Successful fse-verify-target:1

Summary

With Amazon EventBridge support for AWS Lambda function state change events, I confirmed that events for function creation, updating, publishing, and deletion arrive.

Previously, tracking Lambda state changes required custom work such as polling or CloudTrail event filtering, but now a simple mechanism using EventBridge rules is enough.

When deployment pipelines are separated per function, tracking state can become harder in proportion to scale; please try this update as a mitigation.

Share this article

AWSのお困り事はクラスメソッドへ