Created
August 9, 2019 10:39
-
-
Save jitsejan/0effe55c5a72a89edc72373484b6d694 to your computer and use it in GitHub Desktop.
Trigger AWS Lambda function
This file contains hidden or 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 | |
import json | |
REGION = "eu-west-1" | |
ENV = "dev" | |
FUNCTION_NAME = 'lambda-function-name' | |
session = boto3.session.Session(profile_name=ENV) | |
lambda_client = session.client('lambda', REGION) | |
def trigger_lambda_function(value): | |
payload = { | |
"key": value | |
} | |
return lambda_client.invoke(FunctionName=FUNCTION_NAME, | |
InvocationType="Event", | |
Payload=json.dumps(payload)) | |
response = trigger_lambda_function('some_value') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment