Created
August 7, 2018 01:35
-
-
Save jasimmonsv/c6135de86bc39093c1ff50cbf4b58e05 to your computer and use it in GitHub Desktop.
Invoke Lambda from within another Lambda
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
import json | |
import urllib | |
import boto3 | |
lam = boto3.client('lambda') | |
def lambda_handler(event, context): | |
payload = {} | |
payload['key1'] = 'key1' | |
payload['key2'] = 'key2' | |
payload['key3'] = 'key3' | |
try: | |
response = lam.invoke(FunctionName='hello-world', | |
InvocationType='RequestResponse', | |
Payload=json.dumps(payload)) | |
except Exception as e: | |
print(e) | |
raise e | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ensure aws role has:
"Effect": "Allow",
"Action":["lambda:InvokeFunction"],
"Resources":["*"]