Last active
March 12, 2023 15:48
-
-
Save mikaeelkhalid/4f3b10070620583579b5a4c9b1bc60be to your computer and use it in GitHub Desktop.
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 json | |
| import boto3 | |
| client = boto3.client('lambda') | |
| def lambda_handler(event, context): | |
| inputForInvoker = {'Id': '1', 'Price': 100 } | |
| response = client.invoke( | |
| FunctionName='YOUR LAMBDA ARN', | |
| InvocationType='RequestResponse', # Or Event | |
| Payload=json.dumps(inputForInvoker) | |
| ) | |
| responseJson = json.load(response['Payload']) | |
| print(responseJson) |
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
| # AWSLambdaBasicExecutionPolicy | |
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "logs:CreateLogGroup", | |
| "logs:CreateLogStream", | |
| "logs:PutLogEvents" | |
| ], | |
| "Resource": "*" | |
| } | |
| ] | |
| } | |
| # InvokeOtherLambdaPolicy | |
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "VisualEditor0", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "lambda:InvokeFunction", | |
| "lambda:InvokeAsync" | |
| ], | |
| "Resource": "arn:aws:lambda:*:*:function:*" | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment