Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions eventbridge-query-schedules/snippet-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "EventBridge Schedule Finder",
"description": "An interactive CLI command that prompts user inputs to query and find existing EventBridge Scheduler schedules. Supports filtering by schedule name, name prefix, state, group name, and AWS region",
"type": "AWS CLI",
"services": ["eventbridge"],
"tags": [],
"languages": ["bash"],
"introBox": {
"headline": "How it works",
"text": [
"This interactive CLI script prompts the user for optional inputs like Schedule Name, Prefix, State, Group and Region. It dynamically builds the appropriate AWS CLI command using 'get-schedule' for exact lookups or 'list-schedules' for filtered searches. If no filters are provided, it lists all schedules in the specified region."
]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/eventbridge-query-schedules"
}
},
"snippets": [
{
"title": "Copy and paste the snippet into your terminal and enter the optional inputs",
"snippetPath": "snippet.txt",
"language": "bash"
}
],
"authors": [
{
"headline": "Presented by Archana V",
"name": "Archana V",
"image": "https://media.licdn.com/dms/image/v2/D5603AQGhkVtEhllFEw/profile-displayphoto-shrink_400_400/B56ZZH3LL6H0Ag-/0/1744962369913?e=1774483200&v=beta&t=wAhvwq-jEIWnyQwDfIkK_-Sq16Z4RvpjWtYmDkc3eg4",
"bio": "Solutions Architect at AWS",
"linkedin": "archanavenkat"
}
]
}
24 changes: 24 additions & 0 deletions eventbridge-query-schedules/snippet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
echo -n "Schedule Name (or Enter to skip): " && read NAME && \
echo -n "Name Prefix (or Enter to skip): " && read PREFIX && \
echo -n "State [ENABLED/DISABLED/Enter to skip]: " && read STATE && \
echo -n "Group Name (or Enter to skip): " && read GROUP && \
echo -n "Region [us-east-1]: " && read REGION && \
REGION=${REGION:-us-east-1} && \
CMD="" && \
if [ -n "$NAME" ] && [ -z "$STATE" ]; then \
CMD="aws scheduler get-schedule --name $NAME --region $REGION"; \
[ -n "$GROUP" ] && CMD="$CMD --group-name $GROUP"; \
CMD="$CMD --query '{Name:Name,State:State,Expression:ScheduleExpression,Group:GroupName,TargetArn:Target.Arn,Description:Description}' --output table"; \
elif [ -n "$NAME" ] && [ -n "$STATE" ]; then \
CMD="aws scheduler list-schedules --region $REGION --name-prefix $NAME --state $STATE"; \
[ -n "$GROUP" ] && CMD="$CMD --group-name $GROUP"; \
CMD="$CMD --query 'Schedules[?Name==\`$NAME\`].[Name,State,ScheduleExpression,GroupName,Target.Arn]' --output table"; \
else \
CMD="aws scheduler list-schedules --region $REGION"; \
[ -n "$PREFIX" ] && CMD="$CMD --name-prefix $PREFIX"; \
[ -n "$STATE" ] && CMD="$CMD --state $STATE"; \
[ -n "$GROUP" ] && CMD="$CMD --group-name $GROUP"; \
CMD="$CMD --query 'Schedules[].[Name,State,ScheduleExpression,GroupName,Target.Arn]' --output table"; \
fi && \
echo "Running: $CMD" && \
eval $CMD