Skip to content

Commit c6f19e5

Browse files
authored
Merge pull request aws-samples#1404 from shashrv/shashank-feature-dynamo-lambda-eventbridgescheduler-lambda-serverless
Readme updates and removed build generated files
2 parents 382465a + 1df7462 commit c6f19e5

20 files changed

+37
-264
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.js
2+
!jest.config.js
3+
*.d.ts
4+
node_modules
5+
!/lib
6+
# CDK asset staging directory
7+
.cdk.staging
8+
cdk.out
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Exclude typescript source and config
2+
*.ts
3+
tsconfig.json
4+
jest.config.js
5+
test
6+
coverage
7+
.npmignore
8+
9+
# Include javascript files and typescript declarations
10+
!*.js
11+
!*.d.ts

apigw-dynamodb-lambda-scheduler-sqs-cdk/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# AWS DynamoDB to EventBridge Scheduler via AWS Lambda function
22

3-
This pattern demonstrates a sample to delay processing of data or workflow using an Amazon EventBridge Scheduler. A schedule that invokes a target one-time or at regular intervals defined by a cron or rate expression.
3+
This pattern demonstrates a sample to delay Amazon DynamoDB Stream processing using Amazon EventBridge Scheduler. EventBridge Scheduler invokes a target one-time or at regular intervals defined by a cron or rate expression.
44

5-
In this sample, Amazon Apigateway receives a request from end users that has schedule time and event category provided in the body. The data is stored in Amazon DynamoDB table.
5+
Amazon DynamoDB streams are used to deliver event payload to the handlers in near real time. This pattern will help customers with usecases such as process stream events at a particular time window, as well as triggring one target AWS service from EventBridge Scheduler.
66

7-
Amazon DynamoDB table has stream enabled and it publisehs to a Lambda function. Lambda function then calls Amzon EventBridge Scheduler and selects the groups as per the request body.
8-
9-
EventBridge Scheduler provides a universal target parameter that you can use to create customized triggers that targets more than 270 AWS service and over 6,000 API operation on a schedule. In this example, we are showing integration with two targets, i.e. AWS Lamdba Function and Amazon SQS queue.
10-
11-
Learn more about this pattern at Serverless Land Patterns: << Add the live URL here >>
7+
Learn more about this pattern at Serverless Land Patterns: [Delayed processing of Dynamodb stream with EventBridge Scheduler](https://serverlessland.com/patterns/apigw-dynamodb-lambda-scheduler-sqs-cdk)
128

139
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.
1410

@@ -43,17 +39,21 @@ Important: this application uses various AWS services and there are costs associ
4339
cdk deploy
4440
```
4541

42+
## Architecture
43+
44+
![Architecture Diagram](architecture.png)
45+
4646
## How it works
4747

48-
This pattern is designed to help connect producers that are submitting messages into SNS with EventBridge as a way to deliver those same events in a more configuration driven and scalable way. It also helps reduce load and needless code downstream by leveraging AWS EventBridge Pipes to both filter and transform the data from the producer before attaching to an EventBus for further consumption.
48+
In this sample, Amazon Apigateway receives a request from end-users that has a schedule time and event category provided in the request body. The data is stored in Amazon DynamoDB table. Amazon DynamoDB table has stream enabled and it publishes event to a Lambda function. Lambda function invokes Amazon EventBridge Scheduler and selects the groups provided the request body. EventBridge Scheduler provides a universal target parameter that you can use to create customized triggers that targets more than 270 AWS service and over 6,000 API operation on a schedule. In this example, we are showing integration with two targets, i.e. AWS Lamdba Function, and Amazon SQS queue.
4949

5050
Once the pattern is deployed to AWS, you will have the following resources created with the described capabilities
5151

5252
- An edge optimized Amazon API Gateway endpoint that will receive user request
5353
- A Post method to add a new record in Amazon DynamoDB.
5454
- A Get method sent with an id to retrive the scheduler.
5555
- DynamoDB table with DynamoDB Stream enabled.
56-
- Two Amazon Lambda functions
56+
- Amazon Lambda functions
5757
- Producer Lambda function that listens to DynamoDB stream and calls Amazon EventBridge Scheduler
5858
- Consumer Lambda function acts as a target and listens to EventBridge Scheduler. It performs given actions and deletes the schedule.
5959
- An EventBridge Schedule groups in which Producer Lambda function can categories an event.
Loading

apigw-dynamodb-lambda-scheduler-sqs-cdk/bin/aws-dynamodb-lambda-scheduler-lambda-sample.d.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

apigw-dynamodb-lambda-scheduler-sqs-cdk/bin/aws-dynamodb-lambda-scheduler-lambda-sample.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

apigw-dynamodb-lambda-scheduler-sqs-cdk/bin/aws-dynamodb-lambda-scheduler-lambda-sample.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,4 @@ import { AwsDynamodbLambdaSchedulerLambdaSampleStack } from '../lib/aws-dynamodb
55

66
const app = new cdk.App();
77
new AwsDynamodbLambdaSchedulerLambdaSampleStack(app, 'AwsDynamodbLambdaSchedulerLambdaSampleStack', {
8-
/* If you don't specify 'env', this stack will be environment-agnostic.
9-
* Account/Region-dependent features and context lookups will not work,
10-
* but a single synthesized template can be deployed anywhere. */
11-
12-
/* Uncomment the next line to specialize this stack for the AWS Account
13-
* and Region that are implied by the current CLI configuration. */
14-
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
15-
16-
/* Uncomment the next line if you know exactly what Account and Region you
17-
* want to deploy the stack to. */
18-
// env: { account: 'XXXXXXXXXX', region: 'XXXXXXX' },
19-
20-
/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
21-
});
8+
});

apigw-dynamodb-lambda-scheduler-sqs-cdk/example-pattern.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"introBox": {
88
"headline": "How it works",
99
"text": [
10-
"This pattern demonstrates a sample to delay processing of data or workflow using an Amazon EventBridge Scheduler. A schedule that invokes a target one-time or at regular intervals defined by a cron or rate expression. EventBridge scheduling functionality that provides scheduling functionality independent of Event buses and rules. You can create a schedule to invoke targets such as AWS Batch.",
10+
"This pattern demonstrates a sample to delay processing of Dynamodb stream with EventBridge Scheduler. EventBridge Scheduler invokes a target one-time or at regular intervals defined by a cron or rate expression. This service provides scheduling functionality independent of Event buses and rules. You can create a schedule to invoke targets such as Amazon SQS, or AWS Batch.",
11+
"Amazon DynamoDB streams are used to deliver event payload to the handlers in near real time. This pattern will help customers with usecases such as process stream events at a predefined time window, as well as triggring one target AWS service from EventBridge Scheduler.",
1112
"With Amazon EventBrdige Schedule you can invoke more than 270 AWS services and over 6,000 API operations. Without the need to provision and manage infrastructure, or integrate with multiple services, EventBridge Scheduler provides you with the ability to deliver schedules at scale and reduce maintenance costs.",
1213
"This pattern deploys one Amazon APIGateway, two AWS Lambda Functions, one Amazon DynamoDB Stream, one Amazon SQS queue, and two Amazon EventBridge Schedule Groups."
1314
]
@@ -52,7 +53,7 @@
5253
"name": "Shashank Shrivastava",
5354
"image": "https://media.licdn.com/dms/image/D5603AQGrfCgpj_j3mw/profile-displayphoto-shrink_400_400/0/1673343619283?e=1684972800&v=beta&t=SoHAsTjGcrIlf9ToRrNX64I71rhp4MH0Kd9hrTk1bqw",
5455
"bio": "Sr. Cloud Application Architect at Amazon Web Services.",
55-
"linkedin": "https://www.linkedin.com/in/shashank-shrivastava-85788b38/",
56+
"linkedin": "shashank-shrivastava-85788b38/",
5657
"twitter": "@shashanksaid"
5758
}
5859
]

apigw-dynamodb-lambda-scheduler-sqs-cdk/lambdas/dynamo_stream_handler.d.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)