CLI tools are: aws
, jq
, more
, grep
# `jq -C` enables the colors
# `jq -r` outputs raw text format instead of JSON
# `more -R` renders formatting characters like terminal colors
aws lambda list-functions | jq -r '.Functions[].FunctionName'
FUNCTION_NAME=
aws lambda list-event-source-mappings --function-name $FUNCTION_NAME | jq -C | more -R
# Get Queue URL
PREFIX=app-
SUFFIX='-dlq$'
for SQS_URL in $(aws sqs list-queues --queue-name-prefix "$PREFIX" | jq -r '.QueueUrls[]' | grep -- "$SUFFIX"); do
echo $(aws sqs get-queue-attributes --queue-url "$SQS_URL" --attribute-names QueueArn | jq -r .Attributes.QueueArn)
done
FUNCTION_NAME=
SQS_ARN=
aws lambda create-event-source-mapping --function-name "$FUNCTION_NAME" --event-source-arn "$SQS_ARN" --batch-size 5 --enabled --maximum-batching-window-in-seconds 0