且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AWS Lambda使S3上载的CloudFront失效

更新时间:2021-09-28 21:31:49

如果我正确理解了您的问题,则您的lambda函数会知道CloudFront是否应该使之无效,但不知道什么时候该准确发生.

If I understood your question correctly, your lambda function knows whether CloudFront should invalidate or not but does not know when should that happen exactly.

在这种情况下,您可以返回布尔值标志(例如mustInvalidate)作为响应的一部分,以指示应创建一个无效请求.然后,您的应用程序(或任何发起批处理上传请求的程序)可以在上传批处理完成后立即创建/target-location/*无效请求.

In that case, you could return a boolean flag (e.g., mustInvalidate) as part of the response to indicate that an invalidation request should be created. Then, your application (or whatever initiated the batch upload request) can create the /target-location/* invalidation request as soon as the upload batch completes.