Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

not able to fetch the Instanceid and tags via eventbridge cloudtrail pattern to the Lambda function

$
0
0

Following the below eventbridge rule on cloudtrail event to get the instanceid, tags value from lambda

{"source": ["aws.ec2"],"detail-type": ["AWS API Call via CloudTrail"],"detail": {"eventSource": ["ec2.amazonaws.com"],"eventName": ["RunInstances"]  }}

but not able to get the instanceid either of the below code in boto3:

import boto3def lambda_handler(event, context):    if event['eventSource'] == 'ec2.amazonaws.com' and event['eventName'] == 'RunInstances':        # Get the instance ID from the event        instance_id = event['detail']['instance-id']        #instance_id = event['detail']['instancesSet']['items']['instanceId']

Any input how to fetch the instanceid and tags details from the above cloudtrail rule


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>