Skip to content

Instantly share code, notes, and snippets.

@carlosfunk
Created April 24, 2020 03:28
Show Gist options
  • Save carlosfunk/63b28fbea2ba8c7e12e5340bc384ee23 to your computer and use it in GitHub Desktop.
Save carlosfunk/63b28fbea2ba8c7e12e5340bc384ee23 to your computer and use it in GitHub Desktop.

Revisions

  1. carlosfunk created this gist Apr 24, 2020.
    8 changes: 8 additions & 0 deletions invoke_lambda.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    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)