admin管理员组文章数量:1122832
I was reading some documentations, but could not find a way to see them. I was trying to use Cloudtrail, but it seems like it only shows an event record
for the api call performed.
{
"eventVersion": "1.09",
"userIdentity": {
"type": "AssumedRole",
...
}
},
"eventTime": "2024-11-22T16:52:55Z",
"eventSource": "logs.amazonaws",
"eventName": "CreateLogStream",
"awsRegion": "us-east-1",
"sourceIPAddress": ...,
"userAgent": ...,
"requestParameters": {
...
},
"responseElements": null,
"requestID": "df538....b987-2f...24a",
"eventID": "f3e....9f7-8aaf-e00...3d21",
"readOnly": false,
"eventType": "AwsApiCall",
"apiVersion": "20140328",
"managementEvent": true,
"recipientAccountId": "....",
"eventCategory": "Management",
"tlsDetails": {
...
}
}
How can we see the actual request context? e.g. when an lambda function makes a request to download an object in S3. I am hopping to see the request context,so I can debug the condition section of my policy by seeing what keys are present.
I was reading some documentations, but could not find a way to see them. I was trying to use Cloudtrail, but it seems like it only shows an event record
for the api call performed.
{
"eventVersion": "1.09",
"userIdentity": {
"type": "AssumedRole",
...
}
},
"eventTime": "2024-11-22T16:52:55Z",
"eventSource": "logs.amazonaws.com",
"eventName": "CreateLogStream",
"awsRegion": "us-east-1",
"sourceIPAddress": ...,
"userAgent": ...,
"requestParameters": {
...
},
"responseElements": null,
"requestID": "df538....b987-2f...24a",
"eventID": "f3e....9f7-8aaf-e00...3d21",
"readOnly": false,
"eventType": "AwsApiCall",
"apiVersion": "20140328",
"managementEvent": true,
"recipientAccountId": "....",
"eventCategory": "Management",
"tlsDetails": {
...
}
}
How can we see the actual request context? e.g. when an lambda function makes a request to download an object in S3. I am hopping to see the request context,so I can debug the condition section of my policy by seeing what keys are present.
Share Improve this question edited Nov 22, 2024 at 19:48 user3463521 asked Nov 22, 2024 at 17:00 user3463521user3463521 5782 gold badges7 silver badges18 bronze badges 1- Did you check on S3 events instead (PutObject or GetObject)? – fa44 Commented Nov 22, 2024 at 21:22
1 Answer
Reset to default 0CloudTrail is primarily designed to log AWS API calls and events, not the payload or the full request context. To capture the full context or actual content of requests (e.g., a Lambda function downloading an S3 object), you need to use additional configuration.
1 - You can enable S3 Access Logs
2 - Use Lambda’s Logging Mechanisms
logging.info(f"Downloaded object {object_key} from {bucket_name}")
logging.info(f"Response metadata: {response['ResponseMetadata']}")
3 - Enable S3 Object-Level CloudTrail Data Events
These methods, used in combination, will give you a comprehensive view of the actual requests and their contexts. Let me know if you need help implementing any of these!
本文标签: amazon web servicesHow can see what request context looks like for an AWS requestStack Overflow
版权声明:本文标题:amazon web services - How can see what request context looks like for an AWS request? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302135a1931425.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论