- Newest
- Most votes
- Most comments
If i understood correctly, you want to execute code when a customer does put /get. Right? You can do this with an EventBridge rule that triggers a lambda and the lambda executes the logic, performs XYZ . Check Using Eventbridge for S3 .
So, you create a rule for PUT Object with target a lambda that does <generate AssetEncrypted from Asset . execute other custom logic . delete Asset>. The rule pattern can look like this for a bucket called 'test1':
{
"source": ["aws.s3"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["s3.amazonaws.com"],
"eventName": ["PutObject"],
"requestParameters": {
"bucketName": ["test1"]
}
}
}
Then you create a rule for GET object, that has another lambda as a target and performs as above, the logic you need. The rule pattern would be:
{
"source": ["aws.s3"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["s3.amazonaws.com"],
"eventName": ["GetObject"],
"requestParameters": {
"bucketName": ["test1"]
}
}
}
Hi, The way you suggest to catch event on S3 is perfect for post processing, i think,
https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html
i'm searching a method for inserting custom code on asset before requests are processed. E. G. before putting the item in the store I would like to process file (encrypt, update DB from metadata parsed, validation, etc...). ; before i get Object from store (decrypt, etc...), etc... In any case, thank you, I will try to search better also among the possibilities of EventBridge, since you recommend it
Relevant content
- asked 2 years ago
- asked 9 months ago
- asked 8 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 4 months ago