EventBridge Schedule Finder

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

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.

Copy and paste the snippet into your terminal and enter the optional inputs

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
                                


Created by:

Archana V

Archana V

Solutions Architect at AWS

Follow on LinkedIn