Created
April 24, 2020 03:28
-
-
Save carlosfunk/63b28fbea2ba8c7e12e5340bc384ee23 to your computer and use it in GitHub Desktop.
Function to invoke a lamdba from python
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 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