SHARE
TWEET

Untitled

a guest Aug 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import boto3
  2. import json
  3.  
  4. REGION = "eu-west-1"
  5. ENV = "dev"
  6. FUNCTION_NAME = 'lambda-function-name'
  7.  
  8. session = boto3.session.Session(profile_name=ENV)
  9. lambda_client = session.client('lambda', REGION)
  10.  
  11. def trigger_lambda_function(value):
  12.     payload = {
  13.       "key": value
  14.     }
  15.     return lambda_client.invoke(FunctionName=FUNCTION_NAME,
  16.                                 InvocationType="Event",
  17.                                 Payload=json.dumps(payload))
  18.                                
  19. response = trigger_lambda_function('some_value')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top