使用CLI或SDK向Lambda添加Cloudfront触发器



我尝试为lambda添加Cloudfront Distribution触发器,但使用cli或sdk。到目前为止,我已经通过控制台添加了触发器,使用"cloudfront-modify-response-header"的蓝图创建了一个新的lambda,看起来它工作正常,但我无法使用cli检索有关该触发器的信息我试过了:

aws lambda get-policy --function-name myFunctionName --profile xxxx

但我只得到了一个类似的政策

{
"Policy": {
"Version": "2012-10-17",
"Id": "default",
"Statement": [
{
"Sid": "replicator.lambda.GetFunction",
"Effect": "Allow",
"Principal": {
"Service": "replicator.lambda.amazonaws.com"
},
"Action": "lambda:GetFunction",
"Resource": "arn:aws:lambda:us-east-1: 12345678912:function: myFunctionName: 1"
}
]
},
"RevisionId": "b11abfc7-79a7-489e-9bf7-d501234567899"
}

我在AWS控制台中看到的DistributionID、事件类型和其他属性在哪里?

致问候,

cloudfront的get-distribution API调用具有关于lambda@edge:

Specifies the event type that triggers a Lambda function invocation. You can specify the following values:
viewer-request : The function executes when CloudFront receives a request from a viewer and before it checks to see whether the requested object is in the edge cache.
origin-request : The function executes only when CloudFront forwards a request to your origin. When the requested object is in the edge cache, the function doesn't execute.
origin-response : The function executes after CloudFront receives a response from the origin and before it caches the object in the response. When the requested object is in the edge cache, the function doesn't execute.
viewer-response : The function executes before CloudFront returns the requested object to the viewer. The function executes regardless of whether the object was already in the edge cache. If the origin returns an HTTP status code other than HTTP 200 (OK), the function doesn't execute.

最新更新