Trigger AWS StepFunction using S3 Bucket Event
Here’s an code that includes a S3 bucket, an S3 event rule, and an event target that triggers the Step Function when a new file is added to the bucket:




In this example, we first define our S3 bucket (bucket
) and two Lambda functions (lambda1
and lambda2
) using the s3.Bucket
and lambda.Function
classes, respectively.
We then add a S3 event notification to the bucket using the bucket.addEventNotification
method. This notification triggers an SNS topic whenever a new object is created in the bucket that matches the specified suffix.
Next, we define our Step Function and add our Lambda functions as individual steps using the tasks.LambdaInvoke
class, just like in the previous example.
Finally, we define a CloudWatch Events.
Thank You for Reading….