Last active
January 5, 2021 22:09
-
-
Save rgpower/fde877f7139534fb311b6292d9a320ce to your computer and use it in GitHub Desktop.
invoke lambda many times with different payloads, from a sed-based template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# invoke (synchronously) a lambda with a bunch of different uid payloads | |
cat << EOF > user.lst | |
abc123 | |
def345 | |
... more...uids... | |
EOF | |
cat << EOF > sns.json | |
{ | |
"Records": [ | |
{ | |
"Sns": { | |
"MessageId": "165545c9-2a5c-472c-8df2-7ff2be2b3b1b", | |
"Timestamp": "2021-01-05T07:37:00.000Z", | |
"TopicArn": "arn:aws:sns:us-east-1:some-acct-id:some-topic", | |
"Message": "{\"event\":\"activity\",\"uid\":\"TEST_USERID\"}" | |
} | |
} | |
] | |
} | |
EOF | |
for uid in $(cat user.lst); do aws --profile prod lambda invoke --function-name SomeFunctionName --payload $(sed "s/TEST_USERID/$uid/" sns.json | base64) response_$uid.json; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment