Skip to content

Instantly share code, notes, and snippets.

@fizz
Last active November 20, 2025 20:40
Show Gist options
  • Select an option

  • Save fizz/99085e90157aa8e61fe353dc0cad9a39 to your computer and use it in GitHub Desktop.

Select an option

Save fizz/99085e90157aa8e61fe353dc0cad9a39 to your computer and use it in GitHub Desktop.
Send test continue event to ESF
#!/usr/bin/env bash
set -euo pipefail
REGION="${REGION:-us-west-2}"
FUNCTION_PREFIX="${FUNCTION_PREFIX:-elastic-serverless-forwar-ApplicationElasticServer}"
STREAM_ARN="${STREAM_ARN:-arn:aws:kinesis:us-west-2:801458782278:stream/CloudWatchLinuxOSLogs}"
log() { printf '[%s] %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$1"; }
log "Discovering ESF Lambda"
LAMBDA_NAME=$(aws lambda list-functions \
--region "$REGION" \
--query "Functions[?starts_with(FunctionName, '$FUNCTION_PREFIX')].FunctionName" \
--output text)
if [[ -z "$LAMBDA_NAME" || "$LAMBDA_NAME" == "None" ]]; then
log "ERROR: ESF Lambda not found"
exit 1
fi
echo "Lambda: $LAMBDA_NAME"
log "Fetching continue queue URL"
SQS_CONTINUE_URL=$(aws lambda get-function-configuration \
--function-name "$LAMBDA_NAME" \
--region "$REGION" \
--query 'Environment.Variables.SQS_CONTINUE_URL' \
--output text)
if [[ -z "$SQS_CONTINUE_URL" || "$SQS_CONTINUE_URL" == "None" ]]; then
log "ERROR: SQS_CONTINUE_URL not set"
exit 1
fi
echo "Continue queue: $SQS_CONTINUE_URL"
TIMESTAMP=$(date +%s)
PAYLOAD=$(cat <<JSON
{
"input_id": "$STREAM_ARN",
"input_type": "kinesis-data-stream",
"config_hash": "manual-test",
"source": {
"stream_arn": "$STREAM_ARN"
},
"records": [
{
"eventID": "test-event-$TIMESTAMP",
"eventSource": "aws:kinesis",
"eventSourceARN": "$STREAM_ARN",
"awsRegion": "$REGION",
"kinesis": {
"data": "eyJtZXNzYWdlIjoiRVNGLUVORC10ZXN0In0=",
"partitionKey": "test",
"sequenceNumber": "$TIMESTAMP"
}
}
]
}
JSON
)
log "Sending test continue event"
aws sqs send-message \
--queue-url "$SQS_CONTINUE_URL" \
--message-body "$PAYLOAD" \
--region "$REGION"
log "Tail Lambda logs for recent activity"
aws logs tail "/aws/lambda/$LAMBDA_NAME" --since 2m --region "$REGION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment