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
·64 lines (64 loc) · 1.47 KB
/
Copy path3-invoke.sh
File metadata and controls
executable file
·64 lines (64 loc) · 1.47 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -eo pipefail
FUNCTION=$(aws cloudformation describe-stack-resource --stack-name java-events --logical-resource-id function --query 'StackResourceDetail.PhysicalResourceId' --output text)
if [ $1 ]
then
case $1 in
apig)
PAYLOAD='fileb://events/apigateway-v1.json'
;;
cws)
PAYLOAD='fileb://events/cloudwatch-scheduled.json'
;;
cwl)
PAYLOAD='fileb://events/cloudwatch-logs.json'
;;
sns)
PAYLOAD='fileb://events/sns-notification.json'
;;
cdn)
PAYLOAD='fileb://events/cloudfront.json'
;;
cfg)
PAYLOAD='fileb://events/config-rule.json'
;;
cc)
PAYLOAD='fileb://events/codecommit-push.json'
;;
cog)
PAYLOAD='fileb://events/cognito-sync.json'
;;
kin)
PAYLOAD='fileb://events/kinesis-record.json'
;;
fh)
PAYLOAD='fileb://events/firehose-record.json'
;;
lex)
PAYLOAD='fileb://events/lex-flowers.json'
;;
ddb)
PAYLOAD='fileb://events/dynamodb-record.json'
;;
s3)
PAYLOAD='fileb://events/s3-notification.json'
;;
sqs)
PAYLOAD='fileb://events/sqs-record.json'
;;
*)
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 fileb://event.json out.json
fi
cat out.json
echo ""
sleep 2
done