Skip to content

Commit 1547a04

Browse files
committed
added reademe
1 parent 65ffdff commit 1547a04

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Amazon EventBridge Scheduler Workflow
2+
3+
## Overview
4+
This example shows how to use AWS SDKs to work with Amazon EventBridge Scheduler with schedules and schedule groups. The workflow demonstrates how to create and delete one-time and recurring schedules within a schedule group to generate events on a specified target, such as an Amazon Simple Notification Service (Amazon SNS) Topic.
5+
6+
The target SNS topic and the AWS Identity and Access Management (IAM) role used with the schedules are created as part of an AWS CloudFormation stack that is deployed at the start of the workflow, and deleted when the workflow is complete.
7+
8+
![Object Lock Features](../../../workflows/eventbridge_scheduler/resources/scheduler-workflow.png)
9+
10+
This workflow demonstrates the following steps and tasks:
11+
12+
1. **Prepare the Application**
13+
14+
- Prompts the user for an email address to use for the subscription for the SNS topic.
15+
- Prompts the user for a name for the Cloud Formation stack.
16+
- The user must confirm the email subscription to receive event emails.
17+
- Deploys the Cloud Formation template in resources/cfn_template.yaml for resource creation.
18+
- Stores the outputs of the stack into variables for use in the workflow.
19+
- Creates a schedule group for all workflow schedules.
20+
21+
2. **Create a one-time Schedule**
22+
23+
- Creates a one-time schedule to send an initial event.
24+
- Prompts the user for a name for the one-time schedule.
25+
- The user must confirm the email subscription to receive an event email.
26+
- The content of the email should include the name of the newly created schedule.
27+
- Use a Flexible Time Window of 10 minutes and set the schedule to delete after completion.
28+
29+
3. **Create a time-based schedule**
30+
31+
- Prompts the user for a rate per minutes (example: every 2 minutes) for a scheduled recurring event.
32+
- Creates the scheduled event for X times per hour for 1 hour.
33+
- Deletes the schedule when the user is finished.
34+
- Prompts the user to confirm when they are ready to delete the schedule.
35+
36+
4. **Clean up**
37+
38+
- Prompts the user to confirm they want to destroy the stack and clean up all resources.
39+
- Deletes the schedule group.
40+
- Destroys the Cloud Formation stack and wait until the stack has been removed.
41+
42+
## ⚠ Important
43+
44+
* Running this code might result in charges to your AWS account.
45+
* Running the tests might result in charges to your AWS account.
46+
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
47+
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).
48+
49+
## Scenario
50+
51+
### Prerequisites
52+
53+
Before running this workflow, ensure you have:
54+
55+
- An AWS account with proper permissions to use Amazon EventBridge Scheduler and Amazon EventBridge.
56+
57+
### AWS Services Used
58+
59+
This workflow uses the following AWS services:
60+
61+
- Amazon EventBridge Scheduler
62+
- Amazon EventBridge
63+
- Amazon Simple Notification Service (SNS)
64+
- AWS CloudFormation
65+
66+
### Resources
67+
68+
The workflow scenario deploys the AWS CloudFormation stack with the required resources.
69+
70+
### Instructions
71+
72+
After the example compiles, you can run it from the command line. To do so, navigate to
73+
the folder that contains the .sln file and run the following command:
74+
75+
```
76+
dotnet run
77+
```
78+
79+
Alternatively, you can run the example from within your IDE.
80+
81+
This starts an interactive scenario that walks you through creating different types of schedules.
82+
83+
## Amazon EventBridge Scheduler Actions
84+
85+
The workflow covers the following EventBridge Scheduler API actions:
86+
87+
- [`CreateSchedule`](https://docs.aws.amazon.com/scheduler/latest/APIReference/API_CreateSchedule.html)
88+
- [`CreateScheduleGroup`](https://docs.aws.amazon.com/scheduler/latest/APIReference/API_CreateScheduleGroup.html)
89+
- [`DeleteSchedule`](https://docs.aws.amazon.com/scheduler/latest/APIReference/API_DeleteSchedule.html)
90+
- [`DeleteScheduleGroup`](https://docs.aws.amazon.com/scheduler/latest/APIReference/API_DeleteScheduleGroup.html)
91+
92+
## Additional resources
93+
94+
* [EventBridge Scheduler User Guide](https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html)
95+
* [EventBridge Scheduler API Reference](https://docs.aws.amazon.com/scheduler/latest/APIReference/Welcome.html)
96+
97+
---
98+
99+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
100+
SPDX-License-Identifier: Apache-2.0

0 commit comments

Comments
 (0)