forked from awsdocs/aws-lambda-developer-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3-invoke.sh
More file actions
executable file
·38 lines (34 loc) · 739 Bytes
/
Copy path3-invoke.sh
File metadata and controls
executable file
·38 lines (34 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
set -eo pipefail
FUNCTION=$(aws cloudformation describe-stack-resource --stack-name java-basic --logical-resource-id function --query 'StackResourceDetail.PhysicalResourceId' --output text)
if [ $1 ]
then
case $1 in
string)
PAYLOAD='"MYSTRING"'
;;
int | integer)
PAYLOAD=12345
;;
list)
PAYLOAD='[24,25,26]'
;;
divide)
PAYLOAD='[235241,17]'
;;
*)
echo -n "Unknown event type"
;;
esac
fi
while true; do
if [ $PAYLOAD ]
then
aws lambda invoke --function-name $FUNCTION --payload $PAYLOAD out.json
else
aws lambda invoke --function-name $FUNCTION --payload file://event.json out.json
fi
cat out.json
echo ""
sleep 2
done