Skip to content

Instantly share code, notes, and snippets.

@carlosfunk
Created April 24, 2020 03:28
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 carlosfunk/63b28fbea2ba8c7e12e5340bc384ee23 to your computer and use it in GitHub Desktop.
Save carlosfunk/63b28fbea2ba8c7e12e5340bc384ee23 to your computer and use it in GitHub Desktop.
Function to invoke a lamdba from python
import boto3
client = boto3.client('lambda')
def invoke_lambda(stage: str, region: str, name: str) -> List[Dict[str, Any]]:
response = client.invoke(FunctionName=f"{stage}-{region}-{name}", InvocationType="RequestResponse")
string_response = response["Payload"].read().decode("utf-8")
return json.loads(string_response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment