繁体   English   中英

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

[英]Adding Cloudfront trigger to a Lambda using CLI or SDK

我有点 stcuk 试图为 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 cloudfront调用包含有关 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.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM