Skip to content

Commit

Permalink
Add lambda function utils
Browse files Browse the repository at this point in the history
  • Loading branch information
quangnhnhut123 committed Jan 8, 2025
1 parent 36a8419 commit f6c89d3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ COPY ./check-connections.sh /usr/local/bin/check-connections.sh
COPY ./check-envs.sh /usr/local/bin/check-envs.sh
COPY ./ssm-compare.sh /usr/local/bin/ssm-compare.sh
COPY ./ecs-utils.sh /usr/local/bin/ecs-utils.sh
COPY ./lambda-utils.sh /usr/local/bin/lambda-utils.sh

RUN chmod +x /usr/local/bin/check-connections.sh
RUN chmod +x /usr/local/bin/check-envs.sh
RUN chmod +x /usr/local/bin/ssm-compare.sh
RUN chmod +x /usr/local/bin/ecs-utils.sh
RUN chmod +x /usr/local/bin/lambda-utils.sh
22 changes: 22 additions & 0 deletions lambda-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Check if PRODUCT_NAME is provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <PRODUCT_NAME>"
exit 1
fi

# Configurable parameters
PRODUCT_NAME="$1"

functions=$(aws lambda list-functions --query 'Functions[*].FunctionName' --output text)
for function in $functions; do
if [[ $function == *$PRODUCT_NAME* && $function != *-sp* ]]; then
aws lambda put-function-concurrency --function-name $function --reserved-concurrent-executions 0 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Successfully updated concurrency for function: $function to 0"
else
echo "Failed to update concurrency for function: $function to 0"
fi
fi
done

0 comments on commit f6c89d3

Please sign in to comment.