Skip to content

Commit

Permalink
Pass CloudWatch event without encapsulation
Browse files Browse the repository at this point in the history
  • Loading branch information
cristim committed May 7, 2021
1 parent 5deb357 commit 2a07c8f
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions modules/regional/resources/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,12 @@ def parse_region_from_arn(arn):

def handler(event, context):
print("Running Lambda function", lambda_arn)
snsEvent = {
'Records': [
{
'Event': 'aws:sns',
'EventSource': '1.0',
'EventSubscriptionArn': 'arn:aws:sns:' + event['region'] + ':FakeAccountId:FakeTopic',
'Sns': {
'Type': 'Notification',
'Message': dumps(event),
}
}
]
}
try:
svc = client('lambda', region_name=parse_region_from_arn(lambda_arn))
response = svc.invoke(
FunctionName=lambda_arn,
LogType='Tail',
Payload=dumps(snsEvent),
Payload=dumps(event),
)
print("Invoked funcion log tail:\n", b64decode(
response["LogResult"]).decode('utf-8'))
Expand Down

0 comments on commit 2a07c8f

Please sign in to comment.