In the root of this Chapter’s repo cd to the “503-Triggering-Lambda-Functions-on-a-Schedule” directory and follow the subsequent steps:
zip lambda_function.zip lambda_function.py
LAMBDA_ARN=$(aws lambda create-function \
--function-name AWSCookbook503Lambda \
--runtime python3.8 \
--package-type "Zip" \
--zip-file fileb://lambda_function.zip \
--handler lambda_function.lambda_handler --publish \
--role \
arn:aws:iam::$AWS_ACCOUNT_ID:role/AWSCookbookLambdaRole \
--output text --query FunctionArn)
aws events remove-targets --rule "EveryMinuteEvent" \
--ids "1"
aws events delete-rule --name "EveryMinuteEvent"
aws lambda delete-function --function-name AWSCookbook503Lambda
aws logs delete-log-group \
--log-group-name /aws/lambda/AWSCookbook503Lambda
unset LAMBDA_ARN
unset RULE_ARN