Kujtim Hoxha
08/11/2021, 1:26 PMAshishkumar Pandey
08/11/2021, 1:30 PMKujtim Hoxha
08/11/2021, 1:31 PMAshishkumar Pandey
08/11/2021, 1:31 PMRoss Coundon
08/11/2021, 1:34 PMAshishkumar Pandey
08/11/2021, 1:34 PMKujtim Hoxha
08/11/2021, 1:35 PMGuy Shechter
08/11/2021, 1:59 PMconst api = new sst.Api(this, "api", {
defaultFunctionProps: {
runtime: lambda.Runtime.PYTHON_3_8,
srcPath: 'src',
permissions: [
new iam.PolicyStatement({
actions: ['lambda:Invoke*'],
effect: iam.Effect.ALLOW,
resources: [
"*"
]
})
]
},
Then in the lambda handler, you check whether it is a proper HTTP before invoking itself again asynchronously (Event type) to prevent an infinite loop:
client = boto3.client('lambda')
def handler(event, context):
if event.get('requestContext', {}).get('http', {}).get('method') == 'GET':
payload_str = json.dumps( <Build your payload from the event input > )
payload_bytes_arr = bytes(payload_str, encoding='utf8')
response = client.invoke(
FunctionName=context.invoked_function_arn.split(":")[-1],
InvocationType="Event",
Payload=payload_bytes_arr
)
Kujtim Hoxha
08/11/2021, 2:00 PMKujtim Hoxha
08/11/2021, 2:00 PMFrank
Ashishkumar Pandey
08/11/2021, 4:23 PMRoss Coundon
08/11/2021, 7:40 PMKujtim Hoxha
08/11/2021, 7:44 PM