Skip to content

Instantly share code, notes, and snippets.

@jasimmonsv
Created August 7, 2018 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasimmonsv/c6135de86bc39093c1ff50cbf4b58e05 to your computer and use it in GitHub Desktop.
Save jasimmonsv/c6135de86bc39093c1ff50cbf4b58e05 to your computer and use it in GitHub Desktop.
Invoke Lambda from within another Lambda
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)
@jasimmonsv
Copy link
Author

Ensure aws role has:

"Effect": "Allow",
"Action":["lambda:InvokeFunction"],
"Resources":["*"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment