diff --git a/eventbridge-stepfunction-lambda-getfunctionstatus/README.md b/eventbridge-stepfunction-lambda-getfunctionstatus/README.md
new file mode 100644
index 000000000..16a1b3e4e
--- /dev/null
+++ b/eventbridge-stepfunction-lambda-getfunctionstatus/README.md
@@ -0,0 +1,85 @@
+# Amazon EventBridge Scheduler to invoke an AWS Step Function to get the list of inactive AWS Lambda functions
+
+This pattern will create an Amazon EventBridge Scheduler rule targeting an AWS Step Function state machine. The Step Function invokes an AWS Lambda using `ListFunctions` and `GetFunctions` API using the SDK integration in Step Functions. It then publishes the list of inactive functions to an Amazon SNS Topic.
+
+Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example.
+
+## Requirements
+
+* [Create an AWS account](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html) if you do not already have one and log in. The IAM user that you use must have sufficient permissions to make necessary AWS service calls and manage AWS resources.
+* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) installed and configured
+* [Git Installed](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
+* [AWS Serverless Application Model](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) (AWS SAM) installed
+
+## Deployment Instructions
+
+1. Create a new directory, navigate to that directory in a terminal and clone the GitHub repository:
+ ```
+ git clone https://github.com/aws-samples/serverless-patterns
+ ```
+2. Change directory to the pattern directory:
+ ```
+ cd eventbridge-stepfunction-lambda-getfunctionstatus
+ ```
+3. Build the dependencies:
+ ```
+ sam build
+ ```
+4. From the command line, use AWS SAM to deploy the AWS resources for the pattern as specified in the template.yml file:
+ ```
+ sam deploy --guided
+ ```
+5. During the prompts:
+
+
+ * Enter **stack name**.
+ * Enter desired **AWS Region**.
+ * Enter your **Email Address** (e.g. abcd@xyz.com) for the EmailAddress parameter.
+ * Allow SAM CLI to create IAM roles with the required permissions.
+
+ Once you have run `sam deploy --guided` mode once and saved arguments to a configuration file (samconfig.toml), you can use `sam deploy` in future to use these defaults.
+
+6. Note the outputs from the SAM deployment process. These contain the resource names and/or ARNs which are used for testing.
+
+7. **Important** : Once the SNS topic & subscription is created, verify the subscription by clicking the 'Confirm subscription' link received on your email.
+
+
+## How it works
+
+1. When the stack is deployed it creates a state machine, an Event Bridge Scheduler, an SNS topic with email subscription, a Lambda function and required IAM roles.
+
+2. Event Bridge Scheduler invokes the state machine with a defined schedule. The default schedule invokes the state machine daily at 00:00 UTC with the below mentioned payload. Modify the schedule as per your requirement.
+
+ ```json
+ {
+ "Function_ARN_List_existing": {
+ "lambda_arn_list_combined": []
+ },
+ "NextMarker": null
+ }
+ ```
+
+3) In state machine, the 1st step is to get the list of all lambda functions in the current region using the ListFunctions API, ListFunctions API is called multiple times as it returns max 50 functions list in a single API call along with NextMarker pagination parameter. Using NextMarker token state machine retrieves list of all the function ARNs.
+
+4) Lambda Invoke Combine data Step : This a custom Lambda function python script to create a combined JSON array of Lambda function ARNs retrieved in step 1.
+
+5) Map - loop functions state: In this state, the GetFunction API is called for each Lambda ARN taken as input from the previous step, and the status of each function is checked and appended to the output.
+
+6) Filter inactive functions state: This filters out the active functions from the JSON array and passes only the list of inactive functions to the next step.
+
+7) SNS publish : List of inactive functions is published to the SNS Topic.
+
+
+## Cleanup
+
+1. Delete the stack
+ ```bash
+ sam delete
+ ```
+
+2. Also, you have to manually delete any schedules you created if required.
+
+----
+Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+
+SPDX-License-Identifier: MIT-0
\ No newline at end of file
diff --git a/eventbridge-stepfunction-lambda-getfunctionstatus/eventbridge-stepfunction-lambda-getfunctionstatus.json b/eventbridge-stepfunction-lambda-getfunctionstatus/eventbridge-stepfunction-lambda-getfunctionstatus.json
new file mode 100644
index 000000000..3cc7c973b
--- /dev/null
+++ b/eventbridge-stepfunction-lambda-getfunctionstatus/eventbridge-stepfunction-lambda-getfunctionstatus.json
@@ -0,0 +1,97 @@
+{
+ "title": "EventBridge Scheduler to publish daily list of inactive functions to SNS",
+ "description": "Daily running Amazon EventBridge scheduler and invokes a state machine to find Inactive Lambda functions and publish the list to a SNS topic.",
+ "language": "Python",
+ "level": "200",
+ "framework": "SAM",
+ "introBox": {
+ "headline": "How it works",
+ "text": [
+ "Creates a one time schedule in EventBridge scheduler with a StepFunctions state machine as target. Uses the SDK integration to find the Lambda function status, returns the list of inactive functions and publishes the list to a SNS Topic."
+ ]
+ },
+ "gitHub": {
+ "template": {
+ "repoURL": "https://github.com/aws-samples/serverless-patterns/tree/main/eventbridge-stepfunction-lambda-getfunctionstatus",
+ "templateURL": "serverless-patterns/eventbridge-stepfunction-lambda-getfunctionstatus",
+ "projectFolder": "eventbridge-stepfunction-lambda-getfunctionstatus",
+ "templateFile": "template.yaml"
+ }
+ },
+ "resources": {
+ "bullets": [
+ {
+ "text": "Introducing Amazon EventBridge Scheduler",
+ "link": "https://aws.amazon.com/blogs/compute/introducing-amazon-eventbridge-scheduler/"
+ },
+ {
+ "text": "Amazon EventBridge Scheduler Docs",
+ "link": "https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html"
+ },
+ {
+ "text": "Amazon EventBridge Scheduler Docs",
+ "link": "https://docs.aws.amazon.com/lambda/latest/api/API_ListFunctions.html"
+ },
+ {
+ "text": "Lambda ListFunctions API",
+ "link": "https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html"
+ },
+ {
+ "text": "Lambda GetFunction API",
+ "link": "https://docs.aws.amazon.com/lambda/latest/api/API_GetFunction.html"
+ },
+ {
+ "text": "SNS Publish API",
+ "link": "https://docs.aws.amazon.com/sns/latest/api/API_Publish.html"
+ }
+ ]
+ },
+ "deploy": {
+ "text": ["sam deploy"]
+ },
+ "testing": {
+ "text": ["See the GitHub repo for detailed testing instructions."]
+ },
+ "cleanup": {
+ "text": ["Delete the stack: sam delete
."]
+ },
+ "authors": [
+ {
+ "name": "Sahil Kapoor",
+ "image": "https://media.licdn.com/dms/image/v2/D5603AQHTVptga3RxcA/profile-displayphoto-shrink_800_800/B56ZO3ZfseHoAc-/0/1733948735068?e=1739404800&v=beta&t=FX6MFZ2JFH17KQc89u4gY6tQXGoMJLiLkB2qT3MtV2g",
+ "bio": "AWS Cloud Support Engineer",
+ "linkedin": "sahil-kapoor-503391a7",
+ "twitter": ""
+ }
+ ],
+ "patternArch": {
+ "icon1": {
+ "x": 20,
+ "y": 50,
+ "service": "eventbridge-scheduler",
+ "label": "Amazon EventBridge Scheduler"
+ },
+ "icon2": {
+ "x": 50,
+ "y": 50,
+ "service": "step-functions",
+ "label": "AWS Step Function"
+ },
+ "icon3": {
+ "x": 80,
+ "y": 50,
+ "service": "sns",
+ "label": "Amazon SNS"
+ },
+ "line1": {
+ "from": "icon1",
+ "to": "icon2",
+ "label": "invoked daily"
+ },
+ "line2": {
+ "from": "icon2",
+ "to": "icon3",
+ "label": ""
+ }
+ }
+}
diff --git a/eventbridge-stepfunction-lambda-getfunctionstatus/pattern.json b/eventbridge-stepfunction-lambda-getfunctionstatus/pattern.json
new file mode 100644
index 000000000..63bcc3a7d
--- /dev/null
+++ b/eventbridge-stepfunction-lambda-getfunctionstatus/pattern.json
@@ -0,0 +1,73 @@
+{
+ "title": "Find list of Inactive lambda functions and publish it to SNS topic using Step Functions.",
+ "description": "Simple pattern that runs daily using eventbridge scheduler and invokes a state machine to find Inactive functions and publish it to SNS topic.",
+ "language": "Python",
+ "level": "200",
+ "framework": "SAM",
+ "introBox": {
+ "headline": "How it works",
+ "text": [
+ "Creates a one time schedule in eventBridge scheduler with state machine as target and uses SDK integration to find the lambda function status and returns the list of Inactive functions and which is then published to the SNS Topic."
+ ]
+ },
+ "gitHub": {
+ "template": {
+ "repoURL": "https://github.com/aws-samples/serverless-patterns/tree/main/eventbridge-stepfunction-lambda-getfunctionstatus",
+ "templateURL": "serverless-patterns/eventbridge-stepfunction-lambda-getfunctionstatus",
+ "projectFolder": "eventbridge-stepfunction-lambda-getfunctionstatus",
+ "templateFile": "eventbridge-stepfunction-lambda-getfunctionstatus/template.yaml"
+ }
+ },
+ "resources": {
+ "bullets": [
+ {
+ "text": "Introducing Amazon EventBridge Scheduler",
+ "link": "https://aws.amazon.com/blogs/compute/introducing-amazon-eventbridge-scheduler/"
+ },
+ {
+ "text": "Amazon EventBridge Scheduler Docs",
+ "link": "https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html"
+ },
+ {
+ "text": "Amazon EventBridge Scheduler Docs",
+ "link": "https://docs.aws.amazon.com/lambda/latest/api/API_ListFunctions.html"
+ },
+ {
+ "text": "Lambda ListFunctions API",
+ "link": "https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html"
+ },
+ {
+ "text": "Lambda GetFunction API",
+ "link": "https://docs.aws.amazon.com/lambda/latest/api/API_GetFunction.html"
+ },
+ {
+ "text": "SNS Publish API",
+ "link": "https://docs.aws.amazon.com/sns/latest/api/API_Publish.html"
+ }
+ ]
+ },
+ "deploy": {
+ "text": [
+ "sam deploy"
+ ]
+ },
+ "testing": {
+ "text": [
+ "See the GitHub repo for detailed testing instructions."
+ ]
+ },
+ "cleanup": {
+ "text": [
+ "Delete the stack: sam delete
."
+ ]
+ },
+ "authors": [
+ {
+ "name": "Sahil Kapoor",
+ "image": "https://media.licdn.com/dms/image/v2/D5603AQHTVptga3RxcA/profile-displayphoto-shrink_800_800/B56ZO3ZfseHoAc-/0/1733948735068?e=1739404800&v=beta&t=FX6MFZ2JFH17KQc89u4gY6tQXGoMJLiLkB2qT3MtV2g",
+ "bio": "AWS Cloud Support Engineer",
+ "linkedin": "sahil-kapoor-503391a7",
+ "twitter": ""
+ }
+ ]
+}
diff --git a/eventbridge-stepfunction-lambda-getfunctionstatus/src/lambda_function.zip b/eventbridge-stepfunction-lambda-getfunctionstatus/src/lambda_function.zip
new file mode 100644
index 000000000..6ca232e13
Binary files /dev/null and b/eventbridge-stepfunction-lambda-getfunctionstatus/src/lambda_function.zip differ
diff --git a/eventbridge-stepfunction-lambda-getfunctionstatus/statemachine/definition.asl.json b/eventbridge-stepfunction-lambda-getfunctionstatus/statemachine/definition.asl.json
new file mode 100644
index 000000000..5e1c78479
--- /dev/null
+++ b/eventbridge-stepfunction-lambda-getfunctionstatus/statemachine/definition.asl.json
@@ -0,0 +1,149 @@
+{
+ "Comment": "A description of my state machine",
+ "StartAt": "ListFunctions",
+ "States": {
+ "ListFunctions": {
+ "Type": "Task",
+ "Arguments": {
+ "Marker": "{% $states.input.NextMarker%}"
+ },
+ "Resource": "arn:aws:states:::aws-sdk:lambda:listFunctions",
+ "Next": "Lambda Invoke - Combine data",
+ "Output": {
+ "ListFunctions_output": "{% $states.result%}",
+ "Function_ARN_List_existing": {
+ "lambda_arn_list_combined": "{% $states.input.Function_ARN_List_existing.lambda_arn_list_combined%}"
+ }
+ }
+ },
+ "Lambda Invoke - Combine data": {
+ "Type": "Task",
+ "Resource": "arn:aws:states:::lambda:invoke",
+ "Output": "{% $states.result.Payload %}",
+ "Arguments": {
+ "FunctionName": "${LambdaFunctionArn}",
+ "Payload": "{% $states.input %}"
+ },
+ "Retry": [
+ {
+ "ErrorEquals": [
+ "Lambda.ServiceException",
+ "Lambda.AWSLambdaException",
+ "Lambda.SdkClientException",
+ "Lambda.TooManyRequestsException"
+ ],
+ "IntervalSeconds": 1,
+ "MaxAttempts": 3,
+ "BackoffRate": 2,
+ "JitterStrategy": "FULL"
+ }
+ ],
+ "Next": "Check NextMarker"
+ },
+ "Check NextMarker": {
+ "Type": "Choice",
+ "Choices": [
+ {
+ "Next": "ListFunctions",
+ "Condition": "{% $states.input.NextMarkercheck = 'true' %}",
+ "Output": "{% $states.input%}"
+ }
+ ],
+ "Default": "Map - Loop Functions"
+ },
+ "Map - Loop Functions": {
+ "Type": "Map",
+ "ItemProcessor": {
+ "ProcessorConfig": {
+ "Mode": "INLINE"
+ },
+ "StartAt": "GetFunction",
+ "States": {
+ "GetFunction": {
+ "Type": "Task",
+ "Arguments": {
+ "FunctionName": "{% $states.input.ARN %}"
+ },
+ "Resource": "arn:aws:states:::aws-sdk:lambda:getFunction",
+ "Next": "Check Function Status"
+ },
+ "Check Function Status": {
+ "Type": "Choice",
+ "Choices": [
+ {
+ "Next": "Inactive",
+ "Output": {
+ "FunctionConfig": {
+ "ARN": "{% $states.input.Configuration.FunctionArn %}",
+ "State": "{% $states.input.Configuration.State %}",
+ "StateReason": "{% $states.input.Configuration.StateReason %}",
+ "StateReasonCode": "{% $states.input.Configuration.StateReasonCode %}",
+ "LastModified": "{% $states.input.Configuration.LastModified %}"
+ }
+ },
+ "Condition": "{% $states.input.Configuration.State = 'Inactive' %}"
+ }
+ ],
+ "Default": "Pass",
+ "Output": {
+ "FunctionConfig": {
+ "ARN": "{% $states.input.Configuration.FunctionArn %}",
+ "State": "{% $states.input.Configuration.State %}"
+ }
+ }
+ },
+ "Pass": {
+ "Type": "Pass",
+ "End": true
+ },
+ "Inactive": {
+ "Type": "Pass",
+ "End": true
+ }
+ }
+ },
+ "Items": "{% $states.input.Function_ARN_List_existing.lambda_arn_list_combined %}",
+ "Next": "Filter Inactive Functions",
+ "MaxConcurrency": 40
+ },
+ "Filter Inactive Functions": {
+ "Type": "Pass",
+ "Next": "Choice",
+ "Output": {
+ "Inactive_Functions": "{% $states.input.FunctionConfig[State='Inactive'] ? $states.input.FunctionConfig[State='Inactive'] : false %}"
+ }
+ },
+ "Choice": {
+ "Type": "Choice",
+ "Choices": [
+ {
+ "Condition": "{% $states.input.Inactive_Functions = false %}",
+ "Next": "No Inactivce Function",
+ "Output": {
+ "Inactive_Functions": " No Inactive Functions"
+ }
+ }
+ ],
+ "Default": "Inactive function pass state"
+ },
+ "Inactive function pass state": {
+ "Type": "Pass",
+ "Next": "SNS Publish"
+ },
+ "No Inactivce Function": {
+ "Type": "Pass",
+ "Next": "SNS Publish"
+ },
+ "SNS Publish": {
+ "Type": "Task",
+ "Resource": "arn:aws:states:::sns:publish",
+ "Arguments": {
+ "TopicArn": "${TopicARN}",
+ "Message": "{% $states.input.Inactive_Functions %}",
+ "Subject": "Inactive Lambda functions list | ${region} | Account - ${accountID}"
+ },
+ "End": true
+ }
+ },
+ "QueryLanguage": "JSONata"
+}
\ No newline at end of file
diff --git a/eventbridge-stepfunction-lambda-getfunctionstatus/template.yaml b/eventbridge-stepfunction-lambda-getfunctionstatus/template.yaml
new file mode 100644
index 000000000..825ff9d61
--- /dev/null
+++ b/eventbridge-stepfunction-lambda-getfunctionstatus/template.yaml
@@ -0,0 +1,122 @@
+AWSTemplateFormatVersion: '2010-09-09'
+Transform: AWS::Serverless-2016-10-31
+Description: SAM Template for Step Function with daily EventBridge trigger
+
+
+Parameters:
+ EmailAddress:
+ Type: String
+ Description: Email address to subscribe to the SNS topic
+
+
+Resources:
+ StepFunction:
+ Type: AWS::Serverless::StateMachine
+ Properties:
+ Role : !GetAtt StepFunctionEventRole.Arn
+ DefinitionUri: statemachine/definition.asl.json
+ DefinitionSubstitutions:
+ LambdaFunctionArn: !GetAtt LambdaFunction.Arn
+ TopicARN : !GetAtt MySNSTopic.TopicArn
+ region : !Sub ${AWS::Region}
+ accountID : !Sub ${AWS::AccountId}
+
+ DailyEventRule:
+ Type: AWS::Events::Rule
+ Properties:
+ Description: "Trigger Step Function daily at midnight UTC"
+ ScheduleExpression: "cron(0 0 * * ? *)"
+ State: "ENABLED"
+ Targets:
+ - Arn: !Ref StepFunction
+ Id: "StepFunctionTarget"
+ RoleArn: !GetAtt EventBridgeRulerole.Arn
+ Input: '{ "Function_ARN_List_existing": {"lambda_arn_list_combined": []},"NextMarker": null}'
+
+ EventBridgeRulerole:
+ Type: AWS::IAM::Role
+ Properties:
+ AssumeRolePolicyDocument:
+ Version: "2012-10-17"
+ Statement:
+ - Effect: Allow
+ Principal:
+ Service: events.amazonaws.com
+ Action: sts:AssumeRole
+ Policies:
+ - PolicyName: StepFunctionExecutionPolicy
+ PolicyDocument:
+ Version: "2012-10-17"
+ Statement:
+ - Effect: Allow
+ Action:
+ - states:StartExecution
+ Resource: !Ref StepFunction
+
+
+ StepFunctionEventRole:
+ Type: AWS::IAM::Role
+ Properties:
+ AssumeRolePolicyDocument:
+ Version: "2012-10-17"
+ Statement:
+ - Effect: Allow
+ Principal:
+ Service: states.amazonaws.com
+ Action: sts:AssumeRole
+ Policies:
+ - PolicyName: StepFunctionExecutionPolicy
+ PolicyDocument:
+ Version: "2012-10-17"
+ Statement:
+
+ - Effect: Allow
+ Action:
+ - lambda:ListFunctions
+ - lambda:GetFunction
+ Resource: "*"
+
+ - Effect: Allow
+ Action:
+ - sns:Publish
+ Resource: !GetAtt MySNSTopic.TopicArn
+
+ - Effect: Allow
+ Action:
+ - lambda:InvokeFunction
+ Resource: !GetAtt LambdaFunction.Arn
+
+
+ LambdaFunction:
+ Type: AWS::Serverless::Function
+ Properties:
+ FunctionName: GetFunction
+ Handler: lambda_function.lambda_handler
+ CodeUri: src/lambda_function.zip
+ Runtime: python3.13
+
+
+ MySNSTopic:
+ Type: AWS::SNS::Topic
+ Properties:
+ DisplayName: Notify-inactive-functions
+
+ MySNSSubscription:
+ Type: AWS::SNS::Subscription
+ Properties:
+ TopicArn: !Ref MySNSTopic
+ Protocol: email
+ Endpoint: !Ref EmailAddress
+
+
+Outputs:
+ StepFunctionArn:
+ Description: "ARN of the Step Function"
+ Value: !Ref StepFunction
+ EventRuleName:
+ Description: "Name of the EventBridge Rule"
+ Value: !Ref DailyEventRule
+ LambdaFunction:
+ Description: "LambdaFunction ARN"
+ Value: !GetAtt LambdaFunction.Arn
+